@sasjs/core 4.37.0 → 4.37.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -40,15 +40,26 @@
40
40
 
41
41
  Example usage:
42
42
 
43
- %mp_dsmeta(work.sashelp,outds=work.mymeta)
43
+ %mp_dsmeta(sashelp.class,outds=work.mymeta)
44
44
  proc print data=work.mymeta;
45
45
  run;
46
46
 
47
+ For more details on creating datasets from PROC CONTENTS check out this
48
+ excellent [paper](
49
+ https://support.sas.com/resources/papers/proceedings14/1549-2014.pdf) by
50
+ [Louise Hadden](https://www.linkedin.com/in/louisehadden/).
51
+
47
52
  @param libds The library.dataset to export the metadata for
48
53
  @param outds= (work.dsmeta) The output table to contain the metadata
49
54
 
50
55
  <h4> Related Files </h4>
51
56
  @li mp_dsmeta.test.sas
57
+ @li mp_getcols.sas
58
+ @li mp_getdbml.sas
59
+ @li mp_getddl.sas
60
+ @li mp_getformats.sas
61
+ @li mp_getpk.sas
62
+ @li mp_guesspk.sas
52
63
 
53
64
  **/
54
65
 
@@ -146,7 +146,7 @@
146
146
  call symputx(cats('label',_n_),coalescec(label,name),'l');
147
147
  /* overwritten when fmt=Y and a custom format exists in catalog */
148
148
  if typelong='num' then call symputx(cats('fmtlen',_n_),200,'l');
149
- else call symputx(cats('fmtlen',_n_),min(32767,ceil((length+3)*1.5)),'l');
149
+ else call symputx(cats('fmtlen',_n_),min(32767,ceil((length+10)*1.5)),'l');
150
150
  run;
151
151
 
152
152
  %let tempds=%substr(_%sysfunc(compress(%sysfunc(uuidgen()),-)),1,32);
@@ -202,8 +202,8 @@
202
202
  %let tmpds4=%substr(col%sysfunc(compress(%sysfunc(uuidgen()),-)),1,32);
203
203
  proc sql noprint;
204
204
  create table &tmpds1 as
205
- select cats(libname,'.',memname) as fmtcat,
206
- fmtname
205
+ select cats(libname,'.',memname) as FMTCAT,
206
+ FMTNAME
207
207
  from dictionary.formats
208
208
  where fmttype='F' and libname is not null
209
209
  and fmtname in (select format from &colinfo where format is not null)
@@ -228,7 +228,7 @@
228
228
 
229
229
  proc sql;
230
230
  create table &tmpds4 as
231
- select a.*, b.length as maxw
231
+ select a.*, b.length as MAXW
232
232
  from &colinfo a
233
233
  left join &tmpds2 b
234
234
  on cats(a.format)=cats(upcase(b.fmtname))
@@ -239,7 +239,7 @@
239
239
  call symputx(
240
240
  cats('fmtlen',_n_),
241
241
  /* vars need extra padding due to JSON escaping of special chars */
242
- min(32767,ceil((max(length,maxw)+3)*1.5))
242
+ min(32767,ceil((max(length,maxw)+10)*1.5))
243
243
  ,'l'
244
244
  );
245
245
  run;
@@ -314,7 +314,7 @@
314
314
  format _numeric_ bart.;
315
315
  %do i=1 %to &numcols;
316
316
  %if &&typelong&i=char or &fmt=Y %then %do;
317
- if findc(&&name&i,'"\'!!'0A0D09000E0F01021011'x) then do;
317
+ if findc(&&name&i,'"\'!!'0A0D09000E0F010210111A'x) then do;
318
318
  &&name&i='"'!!trim(
319
319
  prxchange('s/"/\\"/',-1, /* double quote */
320
320
  prxchange('s/\x0A/\n/',-1, /* new line */
@@ -327,8 +327,9 @@
327
327
  prxchange('s/\x02/\\u0002/',-1, /* STX */
328
328
  prxchange('s/\x10/\\u0010/',-1, /* DLE */
329
329
  prxchange('s/\x11/\\u0011/',-1, /* DC1 */
330
+ prxchange('s/\x1A/\\u001A/',-1, /* SUB */
330
331
  prxchange('s/\\/\\\\/',-1,&&name&i)
331
- ))))))))))))!!'"';
332
+ )))))))))))))!!'"';
332
333
  end;
333
334
  else &&name&i=quote(cats(&&name&i));
334
335
  %end;
@@ -169,7 +169,7 @@ data _null_;
169
169
  put ' call symputx(cats(''label'',_n_),coalescec(label,name),''l''); ';
170
170
  put ' /* overwritten when fmt=Y and a custom format exists in catalog */ ';
171
171
  put ' if typelong=''num'' then call symputx(cats(''fmtlen'',_n_),200,''l''); ';
172
- put ' else call symputx(cats(''fmtlen'',_n_),min(32767,ceil((length+3)*1.5)),''l''); ';
172
+ put ' else call symputx(cats(''fmtlen'',_n_),min(32767,ceil((length+10)*1.5)),''l''); ';
173
173
  put ' run; ';
174
174
  put ' ';
175
175
  put ' %let tempds=%substr(_%sysfunc(compress(%sysfunc(uuidgen()),-)),1,32); ';
@@ -225,8 +225,8 @@ data _null_;
225
225
  put ' %let tmpds4=%substr(col%sysfunc(compress(%sysfunc(uuidgen()),-)),1,32); ';
226
226
  put ' proc sql noprint; ';
227
227
  put ' create table &tmpds1 as ';
228
- put ' select cats(libname,''.'',memname) as fmtcat, ';
229
- put ' fmtname ';
228
+ put ' select cats(libname,''.'',memname) as FMTCAT, ';
229
+ put ' FMTNAME ';
230
230
  put ' from dictionary.formats ';
231
231
  put ' where fmttype=''F'' and libname is not null ';
232
232
  put ' and fmtname in (select format from &colinfo where format is not null) ';
@@ -251,7 +251,7 @@ data _null_;
251
251
  put ' ';
252
252
  put ' proc sql; ';
253
253
  put ' create table &tmpds4 as ';
254
- put ' select a.*, b.length as maxw ';
254
+ put ' select a.*, b.length as MAXW ';
255
255
  put ' from &colinfo a ';
256
256
  put ' left join &tmpds2 b ';
257
257
  put ' on cats(a.format)=cats(upcase(b.fmtname)) ';
@@ -262,7 +262,7 @@ data _null_;
262
262
  put ' call symputx( ';
263
263
  put ' cats(''fmtlen'',_n_), ';
264
264
  put ' /* vars need extra padding due to JSON escaping of special chars */ ';
265
- put ' min(32767,ceil((max(length,maxw)+3)*1.5)) ';
265
+ put ' min(32767,ceil((max(length,maxw)+10)*1.5)) ';
266
266
  put ' ,''l'' ';
267
267
  put ' ); ';
268
268
  put ' run; ';
@@ -337,7 +337,7 @@ data _null_;
337
337
  put ' format _numeric_ bart.; ';
338
338
  put ' %do i=1 %to &numcols; ';
339
339
  put ' %if &&typelong&i=char or &fmt=Y %then %do; ';
340
- put ' if findc(&&name&i,''"\''!!''0A0D09000E0F01021011''x) then do; ';
340
+ put ' if findc(&&name&i,''"\''!!''0A0D09000E0F010210111A''x) then do; ';
341
341
  put ' &&name&i=''"''!!trim( ';
342
342
  put ' prxchange(''s/"/\\"/'',-1, /* double quote */ ';
343
343
  put ' prxchange(''s/\x0A/\n/'',-1, /* new line */ ';
@@ -350,8 +350,9 @@ data _null_;
350
350
  put ' prxchange(''s/\x02/\\u0002/'',-1, /* STX */ ';
351
351
  put ' prxchange(''s/\x10/\\u0010/'',-1, /* DLE */ ';
352
352
  put ' prxchange(''s/\x11/\\u0011/'',-1, /* DC1 */ ';
353
+ put ' prxchange(''s/\x1A/\\u001A/'',-1, /* SUB */ ';
353
354
  put ' prxchange(''s/\\/\\\\/'',-1,&&name&i) ';
354
- put ' ))))))))))))!!''"''; ';
355
+ put ' )))))))))))))!!''"''; ';
355
356
  put ' end; ';
356
357
  put ' else &&name&i=quote(cats(&&name&i)); ';
357
358
  put ' %end; ';
package/package.json CHANGED
@@ -35,5 +35,5 @@
35
35
  "devDependencies": {
36
36
  "@sasjs/cli": "3.13.0"
37
37
  },
38
- "version": "4.37.0"
38
+ "version": "4.37.1"
39
39
  }
@@ -170,7 +170,7 @@ data _null_;
170
170
  put ' call symputx(cats(''label'',_n_),coalescec(label,name),''l''); ';
171
171
  put ' /* overwritten when fmt=Y and a custom format exists in catalog */ ';
172
172
  put ' if typelong=''num'' then call symputx(cats(''fmtlen'',_n_),200,''l''); ';
173
- put ' else call symputx(cats(''fmtlen'',_n_),min(32767,ceil((length+3)*1.5)),''l''); ';
173
+ put ' else call symputx(cats(''fmtlen'',_n_),min(32767,ceil((length+10)*1.5)),''l''); ';
174
174
  put ' run; ';
175
175
  put ' ';
176
176
  put ' %let tempds=%substr(_%sysfunc(compress(%sysfunc(uuidgen()),-)),1,32); ';
@@ -226,8 +226,8 @@ data _null_;
226
226
  put ' %let tmpds4=%substr(col%sysfunc(compress(%sysfunc(uuidgen()),-)),1,32); ';
227
227
  put ' proc sql noprint; ';
228
228
  put ' create table &tmpds1 as ';
229
- put ' select cats(libname,''.'',memname) as fmtcat, ';
230
- put ' fmtname ';
229
+ put ' select cats(libname,''.'',memname) as FMTCAT, ';
230
+ put ' FMTNAME ';
231
231
  put ' from dictionary.formats ';
232
232
  put ' where fmttype=''F'' and libname is not null ';
233
233
  put ' and fmtname in (select format from &colinfo where format is not null) ';
@@ -252,7 +252,7 @@ data _null_;
252
252
  put ' ';
253
253
  put ' proc sql; ';
254
254
  put ' create table &tmpds4 as ';
255
- put ' select a.*, b.length as maxw ';
255
+ put ' select a.*, b.length as MAXW ';
256
256
  put ' from &colinfo a ';
257
257
  put ' left join &tmpds2 b ';
258
258
  put ' on cats(a.format)=cats(upcase(b.fmtname)) ';
@@ -263,7 +263,7 @@ data _null_;
263
263
  put ' call symputx( ';
264
264
  put ' cats(''fmtlen'',_n_), ';
265
265
  put ' /* vars need extra padding due to JSON escaping of special chars */ ';
266
- put ' min(32767,ceil((max(length,maxw)+3)*1.5)) ';
266
+ put ' min(32767,ceil((max(length,maxw)+10)*1.5)) ';
267
267
  put ' ,''l'' ';
268
268
  put ' ); ';
269
269
  put ' run; ';
@@ -338,7 +338,7 @@ data _null_;
338
338
  put ' format _numeric_ bart.; ';
339
339
  put ' %do i=1 %to &numcols; ';
340
340
  put ' %if &&typelong&i=char or &fmt=Y %then %do; ';
341
- put ' if findc(&&name&i,''"\''!!''0A0D09000E0F01021011''x) then do; ';
341
+ put ' if findc(&&name&i,''"\''!!''0A0D09000E0F010210111A''x) then do; ';
342
342
  put ' &&name&i=''"''!!trim( ';
343
343
  put ' prxchange(''s/"/\\"/'',-1, /* double quote */ ';
344
344
  put ' prxchange(''s/\x0A/\n/'',-1, /* new line */ ';
@@ -351,8 +351,9 @@ data _null_;
351
351
  put ' prxchange(''s/\x02/\\u0002/'',-1, /* STX */ ';
352
352
  put ' prxchange(''s/\x10/\\u0010/'',-1, /* DLE */ ';
353
353
  put ' prxchange(''s/\x11/\\u0011/'',-1, /* DC1 */ ';
354
+ put ' prxchange(''s/\x1A/\\u001A/'',-1, /* SUB */ ';
354
355
  put ' prxchange(''s/\\/\\\\/'',-1,&&name&i) ';
355
- put ' ))))))))))))!!''"''; ';
356
+ put ' )))))))))))))!!''"''; ';
356
357
  put ' end; ';
357
358
  put ' else &&name&i=quote(cats(&&name&i)); ';
358
359
  put ' %end; ';
@@ -312,7 +312,7 @@ data _null_;
312
312
  put ' call symputx(cats(''label'',_n_),coalescec(label,name),''l''); ';
313
313
  put ' /* overwritten when fmt=Y and a custom format exists in catalog */ ';
314
314
  put ' if typelong=''num'' then call symputx(cats(''fmtlen'',_n_),200,''l''); ';
315
- put ' else call symputx(cats(''fmtlen'',_n_),min(32767,ceil((length+3)*1.5)),''l''); ';
315
+ put ' else call symputx(cats(''fmtlen'',_n_),min(32767,ceil((length+10)*1.5)),''l''); ';
316
316
  put ' run; ';
317
317
  put ' ';
318
318
  put ' %let tempds=%substr(_%sysfunc(compress(%sysfunc(uuidgen()),-)),1,32); ';
@@ -368,8 +368,8 @@ data _null_;
368
368
  put ' %let tmpds4=%substr(col%sysfunc(compress(%sysfunc(uuidgen()),-)),1,32); ';
369
369
  put ' proc sql noprint; ';
370
370
  put ' create table &tmpds1 as ';
371
- put ' select cats(libname,''.'',memname) as fmtcat, ';
372
- put ' fmtname ';
371
+ put ' select cats(libname,''.'',memname) as FMTCAT, ';
372
+ put ' FMTNAME ';
373
373
  put ' from dictionary.formats ';
374
374
  put ' where fmttype=''F'' and libname is not null ';
375
375
  put ' and fmtname in (select format from &colinfo where format is not null) ';
@@ -394,7 +394,7 @@ data _null_;
394
394
  put ' ';
395
395
  put ' proc sql; ';
396
396
  put ' create table &tmpds4 as ';
397
- put ' select a.*, b.length as maxw ';
397
+ put ' select a.*, b.length as MAXW ';
398
398
  put ' from &colinfo a ';
399
399
  put ' left join &tmpds2 b ';
400
400
  put ' on cats(a.format)=cats(upcase(b.fmtname)) ';
@@ -405,7 +405,7 @@ data _null_;
405
405
  put ' call symputx( ';
406
406
  put ' cats(''fmtlen'',_n_), ';
407
407
  put ' /* vars need extra padding due to JSON escaping of special chars */ ';
408
- put ' min(32767,ceil((max(length,maxw)+3)*1.5)) ';
408
+ put ' min(32767,ceil((max(length,maxw)+10)*1.5)) ';
409
409
  put ' ,''l'' ';
410
410
  put ' ); ';
411
411
  put ' run; ';
@@ -480,7 +480,7 @@ data _null_;
480
480
  put ' format _numeric_ bart.; ';
481
481
  put ' %do i=1 %to &numcols; ';
482
482
  put ' %if &&typelong&i=char or &fmt=Y %then %do; ';
483
- put ' if findc(&&name&i,''"\''!!''0A0D09000E0F01021011''x) then do; ';
483
+ put ' if findc(&&name&i,''"\''!!''0A0D09000E0F010210111A''x) then do; ';
484
484
  put ' &&name&i=''"''!!trim( ';
485
485
  put ' prxchange(''s/"/\\"/'',-1, /* double quote */ ';
486
486
  put ' prxchange(''s/\x0A/\n/'',-1, /* new line */ ';
@@ -493,8 +493,9 @@ data _null_;
493
493
  put ' prxchange(''s/\x02/\\u0002/'',-1, /* STX */ ';
494
494
  put ' prxchange(''s/\x10/\\u0010/'',-1, /* DLE */ ';
495
495
  put ' prxchange(''s/\x11/\\u0011/'',-1, /* DC1 */ ';
496
+ put ' prxchange(''s/\x1A/\\u001A/'',-1, /* SUB */ ';
496
497
  put ' prxchange(''s/\\/\\\\/'',-1,&&name&i) ';
497
- put ' ))))))))))))!!''"''; ';
498
+ put ' )))))))))))))!!''"''; ';
498
499
  put ' end; ';
499
500
  put ' else &&name&i=quote(cats(&&name&i)); ';
500
501
  put ' %end; ';