@sasjs/core 4.37.0 → 4.37.3
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.
- package/base/mp_dsmeta.sas +12 -1
- package/base/mp_jsonout.sas +8 -7
- package/meta/mm_createwebservice.sas +8 -7
- package/meta/mm_getstpinfo.sas +1 -1
- package/package.json +1 -1
- package/server/ms_createwebservice.sas +8 -7
- package/viya/mv_createjob.sas +33 -11
- package/viya/mv_createwebservice.sas +8 -7
package/base/mp_dsmeta.sas
CHANGED
|
@@ -40,15 +40,26 @@
|
|
|
40
40
|
|
|
41
41
|
Example usage:
|
|
42
42
|
|
|
43
|
-
%mp_dsmeta(
|
|
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
|
|
package/base/mp_jsonout.sas
CHANGED
|
@@ -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+
|
|
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
|
|
206
|
-
|
|
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
|
|
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)+
|
|
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,'"\'!!'
|
|
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+
|
|
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
|
|
229
|
-
put '
|
|
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
|
|
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)+
|
|
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,''"\''!!''
|
|
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/meta/mm_getstpinfo.sas
CHANGED
package/package.json
CHANGED
|
@@ -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+
|
|
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
|
|
230
|
-
put '
|
|
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
|
|
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)+
|
|
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,''"\''!!''
|
|
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; ';
|
package/viya/mv_createjob.sas
CHANGED
|
@@ -34,14 +34,25 @@
|
|
|
34
34
|
|
|
35
35
|
@param path= The full path (on SAS Drive) where the job will be created
|
|
36
36
|
@param name= The name of the job
|
|
37
|
-
@param desc=
|
|
37
|
+
@param desc= (Created by the mv_createjob.sas macro) The job description
|
|
38
38
|
@param precode= Space separated list of filerefs, pointing to the code that
|
|
39
39
|
needs to be attached to the beginning of the job
|
|
40
|
-
@param code= Fileref(s) of the actual code to be added
|
|
41
|
-
@param access_token_var=
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
40
|
+
@param code= (ft15f001) Fileref(s) of the actual code to be added
|
|
41
|
+
@param access_token_var= (ACCESS_TOKEN) Global macro variable containing the
|
|
42
|
+
access token
|
|
43
|
+
@param grant_type= (sas_services) Valid values:
|
|
44
|
+
@li sas_services
|
|
45
|
+
@li detect
|
|
46
|
+
@li authorization_code
|
|
47
|
+
@li password
|
|
48
|
+
@param replace= (YES) select NO to avoid replacing any existing job
|
|
49
|
+
@param addjesbeginendmacros= (false) Relates to the `_addjesbeginendmacros`
|
|
50
|
+
setting. Normally this would always be false however due to a Viya bug
|
|
51
|
+
(https://github.com/sasjs/cli/issues/1229) this is now configurable. Valid
|
|
52
|
+
values:
|
|
53
|
+
@li true
|
|
54
|
+
@li false
|
|
55
|
+
@li 0 - this will prevent the flag from being set (job will default to true)
|
|
45
56
|
@param contextname= Choose a specific context on which to run the Job. Leave
|
|
46
57
|
blank to use the default context. From Viya 3.5 it is possible to configure
|
|
47
58
|
a shared context - see
|
|
@@ -62,6 +73,7 @@ https://go.documentation.sas.com/?docsetId=calcontexts&docsetTarget=n1hjn8eobk5p
|
|
|
62
73
|
,replace=YES
|
|
63
74
|
,debug=0
|
|
64
75
|
,contextname=
|
|
76
|
+
,addjesbeginendmacros=false
|
|
65
77
|
);
|
|
66
78
|
%local oauth_bearer;
|
|
67
79
|
%if &grant_type=detect %then %do;
|
|
@@ -185,19 +197,29 @@ run;
|
|
|
185
197
|
%end;
|
|
186
198
|
|
|
187
199
|
/* set up the body of the request to create the service */
|
|
188
|
-
%local fname3;
|
|
200
|
+
%local fname3 comma;
|
|
189
201
|
%let fname3=%mf_getuniquefileref();
|
|
190
202
|
data _null_;
|
|
191
203
|
file &fname3 TERMSTR=' ';
|
|
192
204
|
length string $32767;
|
|
193
205
|
string=cats('{"version": 0,"name":"'
|
|
194
206
|
,"&name"
|
|
195
|
-
,'","type":"Compute","parameters":[
|
|
196
|
-
|
|
207
|
+
,'","type":"Compute","parameters":['
|
|
208
|
+
%if &addjesbeginendmacros ne 0 %then %do;
|
|
209
|
+
,'{"name":"_addjesbeginendmacros"'
|
|
210
|
+
,',"type":"CHARACTER","defaultValue":"'
|
|
211
|
+
,"&addjesbeginendmacros"
|
|
212
|
+
,'"}'
|
|
213
|
+
%let comma=%str(,);
|
|
214
|
+
%end;
|
|
215
|
+
);
|
|
197
216
|
context=quote(cats(symget('contextname')));
|
|
198
217
|
if context ne '""' then do;
|
|
199
|
-
string=cats(string
|
|
200
|
-
,
|
|
218
|
+
string=cats(string
|
|
219
|
+
,"&comma"
|
|
220
|
+
,'{"version": 1,"name": "_contextName","defaultValue":'
|
|
221
|
+
,context,',"type":"CHARACTER","label":"Context Name","required": false}'
|
|
222
|
+
);
|
|
201
223
|
end;
|
|
202
224
|
string=cats(string,'],"code":"');
|
|
203
225
|
put string;
|
|
@@ -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+
|
|
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
|
|
372
|
-
put '
|
|
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
|
|
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)+
|
|
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,''"\''!!''
|
|
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; ';
|