@sasjs/core 3.9.0 → 3.10.0
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_dirlist.sas +30 -9
- package/base/mp_ds2cards.sas +4 -3
- package/base/mp_ds2csv.sas +1 -1
- package/base/mp_filtercheck.sas +2 -2
- package/base/mp_getddl.sas +1 -1
- package/base/mp_init.sas +1 -0
- package/base/mp_testservice.sas +1 -1
- package/base/mp_validatecol.sas +4 -2
- package/meta/mm_createwebservice.sas +6 -3
- package/meta/mm_getservercontexts.sas +1 -1
- package/meta/mm_webout.sas +2 -1
- package/package.json +1 -1
- package/server/ms_webout.sas +2 -1
- package/viya/mv_createwebservice.sas +7 -4
- package/viya/mv_jobflow.sas +1 -1
- package/viya/mv_webout.sas +3 -2
package/base/mp_dirlist.sas
CHANGED
|
@@ -6,8 +6,7 @@
|
|
|
6
6
|
Credit for the rename approach:
|
|
7
7
|
https://communities.sas.com/t5/SAS-Programming/SAS-Function-to-convert-string-to-Legal-SAS-Name/m-p/27375/highlight/true#M5003
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
usage:
|
|
9
|
+
Usage:
|
|
11
10
|
|
|
12
11
|
%mp_dirlist(path=/some/location, outds=myTable, maxdepth=MAX)
|
|
13
12
|
|
|
@@ -23,12 +22,12 @@
|
|
|
23
22
|
X CMD) do please raise an issue!
|
|
24
23
|
|
|
25
24
|
|
|
26
|
-
@param [in] path= for which to return contents
|
|
27
|
-
@param [in] fref= Provide a DISK engine fileref as an alternative to PATH
|
|
25
|
+
@param [in] path= (%sysfunc(pathname(work))) Path for which to return contents
|
|
26
|
+
@param [in] fref= (0) Provide a DISK engine fileref as an alternative to PATH
|
|
28
27
|
@param [in] maxdepth= (0) Set to a positive integer to indicate the level of
|
|
29
28
|
subdirectory scan recursion - eg 3, to go `./3/levels/deep`. For unlimited
|
|
30
29
|
recursion, set to MAX.
|
|
31
|
-
@param [out] outds=
|
|
30
|
+
@param [out] outds= (work.mp_dirlist) The output dataset to create
|
|
32
31
|
@param [out] getattrs= (NO) If getattrs=YES then the doptname / foptname
|
|
33
32
|
functions are used to scan all properties - any characters that are not
|
|
34
33
|
valid in a SAS name (v7) are simply stripped, and the table is transposed
|
|
@@ -49,13 +48,15 @@
|
|
|
49
48
|
- OS SPECIFIC variables, if <code>getattrs=</code> is used.
|
|
50
49
|
|
|
51
50
|
<h4> SAS Macros </h4>
|
|
51
|
+
@li mf_existds.sas
|
|
52
|
+
@li mf_getvarlist.sas
|
|
53
|
+
@li mf_wordsinstr1butnotstr2.sas
|
|
52
54
|
@li mp_dropmembers.sas
|
|
53
55
|
|
|
54
56
|
<h4> Related Macros </h4>
|
|
55
57
|
@li mp_dirlist.test.sas
|
|
56
58
|
|
|
57
59
|
@version 9.2
|
|
58
|
-
@author Allan Bowe
|
|
59
60
|
**/
|
|
60
61
|
|
|
61
62
|
%macro mp_dirlist(path=%sysfunc(pathname(work))
|
|
@@ -193,9 +194,29 @@ data &out_ds;
|
|
|
193
194
|
set &out_ds(where=(filepath ne ''));
|
|
194
195
|
run;
|
|
195
196
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
197
|
+
/**
|
|
198
|
+
* The above transpose can mean that some updates create additional columns.
|
|
199
|
+
* This necessitates the occasional use of datastep over proc append.
|
|
200
|
+
*/
|
|
201
|
+
%if %mf_existds(&outds) %then %do;
|
|
202
|
+
%local basevars appvars newvars;
|
|
203
|
+
%let basevars=%mf_getvarlist(&outds);
|
|
204
|
+
%let appvars=%mf_getvarlist(&out_ds);
|
|
205
|
+
%let newvars=%length(%mf_wordsinstr1butnotstr2(Str1=&appvars,Str2=&basevars));
|
|
206
|
+
%if &newvars>0 %then %do;
|
|
207
|
+
data &outds;
|
|
208
|
+
set &outds &out_ds;
|
|
209
|
+
run;
|
|
210
|
+
%end;
|
|
211
|
+
%else %do;
|
|
212
|
+
proc append base=&outds data=&out_ds force nowarn;
|
|
213
|
+
run;
|
|
214
|
+
%end;
|
|
215
|
+
%end;
|
|
216
|
+
%else %do;
|
|
217
|
+
proc append base=&outds data=&out_ds;
|
|
218
|
+
run;
|
|
219
|
+
%end;
|
|
199
220
|
|
|
200
221
|
/* recursive call */
|
|
201
222
|
%if &maxdepth>&level or &maxdepth=MAX %then %do;
|
package/base/mp_ds2cards.sas
CHANGED
|
@@ -139,8 +139,9 @@ create table datalines1 as
|
|
|
139
139
|
/**
|
|
140
140
|
Due to long decimals cannot use best. format
|
|
141
141
|
So - use bestd. format and then use character functions to strip trailing
|
|
142
|
-
zeros, if NOT an integer!!
|
|
143
|
-
|
|
142
|
+
zeros, if NOT an integer or missing!! Cannot use int() as it upsets
|
|
143
|
+
note2err when there are missings.
|
|
144
|
+
resolved code = ifc( mod(coalesce(VARIABLE,0),1)=0
|
|
144
145
|
,put(VARIABLE,best32.)
|
|
145
146
|
,substrn(put(VARIABLE,bestd32.),1
|
|
146
147
|
,findc(put(VARIABLE,bestd32.),'0','TBK')));
|
|
@@ -151,7 +152,7 @@ data datalines_2;
|
|
|
151
152
|
set datalines1 (where=(upcase(name) not in
|
|
152
153
|
('PROCESSED_DTTM','VALID_FROM_DTTM','VALID_TO_DTTM')));
|
|
153
154
|
if type='num' then dataline=
|
|
154
|
-
cats('ifc(
|
|
155
|
+
cats('ifc(mod(coalesce(',name,',0),1)=0
|
|
155
156
|
,put(',name,',best32.-l)
|
|
156
157
|
,substrn(put(',name,',bestd32.-l),1
|
|
157
158
|
,findc(put(',name,',bestd32.-l),"0","TBK")))');
|
package/base/mp_ds2csv.sas
CHANGED
|
@@ -41,7 +41,7 @@ data _null_;
|
|
|
41
41
|
dsid=open("&ds.","i");
|
|
42
42
|
num=attrn(dsid,"nvars");
|
|
43
43
|
do i=1 to num;
|
|
44
|
-
header =
|
|
44
|
+
header = cats(coalescec(varlabel(dsid,i),varname(dsid,i)));
|
|
45
45
|
put header @;
|
|
46
46
|
end;
|
|
47
47
|
rc=close(dsid);
|
package/base/mp_filtercheck.sas
CHANGED
|
@@ -109,7 +109,7 @@ data &outds;
|
|
|
109
109
|
output;
|
|
110
110
|
end;
|
|
111
111
|
if mod(SUBGROUP_ID,1) ne 0 then do;
|
|
112
|
-
REASON_CD='SUBGROUP_ID should be integer, not '!!
|
|
112
|
+
REASON_CD='SUBGROUP_ID should be integer, not '!!cats(subgroup_id);
|
|
113
113
|
putlog REASON_CD= SUBGROUP_ID=;
|
|
114
114
|
call symputx('reason_cd',reason_cd,'l');
|
|
115
115
|
call symputx('nobs',_n_,'l');
|
|
@@ -127,7 +127,7 @@ data &outds;
|
|
|
127
127
|
if OPERATOR_NM not in
|
|
128
128
|
('=','>','<','<=','>=','BETWEEN','IN','NOT IN','NE','CONTAINS')
|
|
129
129
|
then do;
|
|
130
|
-
REASON_CD='Invalid OPERATOR_NM: '!!
|
|
130
|
+
REASON_CD='Invalid OPERATOR_NM: '!!cats(OPERATOR_NM);
|
|
131
131
|
putlog REASON_CD= OPERATOR_NM=;
|
|
132
132
|
call symputx('reason_cd',reason_cd,'l');
|
|
133
133
|
call symputx('nobs',_n_,'l');
|
package/base/mp_getddl.sas
CHANGED
|
@@ -158,7 +158,7 @@ run;
|
|
|
158
158
|
lab=" label="!!cats("'",tranwrd(label,"'","''"),"'");
|
|
159
159
|
if notnull='yes' then notnul=' not null';
|
|
160
160
|
if type='char' then typ=cats('char(',length,')');
|
|
161
|
-
else if length ne 8 then typ='num length='!!
|
|
161
|
+
else if length ne 8 then typ='num length='!!cats(length);
|
|
162
162
|
else typ='num';
|
|
163
163
|
put name typ fmt notnul lab;
|
|
164
164
|
run;
|
package/base/mp_init.sas
CHANGED
|
@@ -51,6 +51,7 @@
|
|
|
51
51
|
noautocorrect /* disallow misspelled procedure names */
|
|
52
52
|
compress=CHAR /* default is none so ensure we have something! */
|
|
53
53
|
datastmtchk=ALLKEYWORDS /* protection from overwriting input datasets */
|
|
54
|
+
dsoptions=note2err /* undocumented - convert bad NOTEs to ERRs */
|
|
54
55
|
%str(err)orcheck=STRICT /* catch errs in libname/filename statements */
|
|
55
56
|
fmterr /* ensure err when a format cannot be found */
|
|
56
57
|
mergenoby=%str(ERR)OR /* throw err when a merge has no BY variables */
|
package/base/mp_testservice.sas
CHANGED
package/base/mp_validatecol.sas
CHANGED
|
@@ -48,9 +48,11 @@
|
|
|
48
48
|
%let tempcol=%mf_getuniquename();
|
|
49
49
|
|
|
50
50
|
%if &rule=ISINT %then %do;
|
|
51
|
-
&tempcol=input(&incol,?? best32.);
|
|
52
51
|
&outcol=0;
|
|
53
|
-
if not missing(&
|
|
52
|
+
if not missing(&incol) then do;
|
|
53
|
+
&tempcol=input(&incol,?? best32.);
|
|
54
|
+
if not missing(&tempcol) then if mod(&tempcol,1)=0 then &outcol=1;
|
|
55
|
+
end;
|
|
54
56
|
drop &tempcol;
|
|
55
57
|
%end;
|
|
56
58
|
%else %if &rule=ISNUM %then %do;
|
|
@@ -383,7 +383,7 @@ data _null_;
|
|
|
383
383
|
put ' set &tempds; ';
|
|
384
384
|
put ' if not (upcase(name) =:"DATA"); /* ignore temp datasets */ ';
|
|
385
385
|
put ' i+1; ';
|
|
386
|
-
put ' call symputx(''wt''
|
|
386
|
+
put ' call symputx(cats(''wt'',i),name,''l''); ';
|
|
387
387
|
put ' call symputx(''wtcnt'',i,''l''); ';
|
|
388
388
|
put ' data _null_; file &fref mod encoding=''utf-8''; ';
|
|
389
389
|
put ' put ",""WORK"":{"; ';
|
|
@@ -427,6 +427,7 @@ data _null_;
|
|
|
427
427
|
put ' put '',"SYSVLONG" : '' sysvlong; ';
|
|
428
428
|
put ' put ",""SYSWARNINGTEXT"" : ""&syswarningtext"" "; ';
|
|
429
429
|
put ' put '',"END_DTTM" : "'' "%sysfunc(datetime(),datetime20.3)" ''" ''; ';
|
|
430
|
+
put ' length memsize $32; ';
|
|
430
431
|
put ' memsize="%sysfunc(INPUTN(%sysfunc(getoption(memsize)), best.),sizekmg.)"; ';
|
|
431
432
|
put ' memsize=quote(cats(memsize)); ';
|
|
432
433
|
put ' put '',"MEMSIZE" : '' memsize; ';
|
|
@@ -457,8 +458,10 @@ data _null_;
|
|
|
457
458
|
put ' ';
|
|
458
459
|
put '%mend mf_getuser; ';
|
|
459
460
|
/* WEBOUT END */
|
|
460
|
-
put '%macro webout(action,ds,dslabel=,fmt=,missing=NULL);';
|
|
461
|
-
put ' %mm_webout(&action,ds=&ds,dslabel=&dslabel,fmt=&fmt,missing=&missing
|
|
461
|
+
put '%macro webout(action,ds,dslabel=,fmt=,missing=NULL,showmeta=NO);';
|
|
462
|
+
put ' %mm_webout(&action,ds=&ds,dslabel=&dslabel,fmt=&fmt,missing=&missing';
|
|
463
|
+
put ' ,showmeta=&showmeta';
|
|
464
|
+
put ' )';
|
|
462
465
|
put '%mend;';
|
|
463
466
|
run;
|
|
464
467
|
|
package/meta/mm_webout.sas
CHANGED
|
@@ -122,7 +122,7 @@
|
|
|
122
122
|
set &tempds;
|
|
123
123
|
if not (upcase(name) =:"DATA"); /* ignore temp datasets */
|
|
124
124
|
i+1;
|
|
125
|
-
call symputx('wt'
|
|
125
|
+
call symputx(cats('wt',i),name,'l');
|
|
126
126
|
call symputx('wtcnt',i,'l');
|
|
127
127
|
data _null_; file &fref mod encoding='utf-8';
|
|
128
128
|
put ",""WORK"":{";
|
|
@@ -166,6 +166,7 @@
|
|
|
166
166
|
put ',"SYSVLONG" : ' sysvlong;
|
|
167
167
|
put ",""SYSWARNINGTEXT"" : ""&syswarningtext"" ";
|
|
168
168
|
put ',"END_DTTM" : "' "%sysfunc(datetime(),datetime20.3)" '" ';
|
|
169
|
+
length memsize $32;
|
|
169
170
|
memsize="%sysfunc(INPUTN(%sysfunc(getoption(memsize)), best.),sizekmg.)";
|
|
170
171
|
memsize=quote(cats(memsize));
|
|
171
172
|
put ',"MEMSIZE" : ' memsize;
|
package/package.json
CHANGED
package/server/ms_webout.sas
CHANGED
|
@@ -114,7 +114,7 @@
|
|
|
114
114
|
set &tempds;
|
|
115
115
|
if not (upcase(name) =:"DATA"); /* ignore temp datasets */
|
|
116
116
|
i+1;
|
|
117
|
-
call symputx('wt'
|
|
117
|
+
call symputx(cats('wt',i),name,'l');
|
|
118
118
|
call symputx('wtcnt',i,'l');
|
|
119
119
|
data _null_; file &fref mod encoding='utf-8' termstr=lf;
|
|
120
120
|
put ",""WORK"":{";
|
|
@@ -165,6 +165,7 @@
|
|
|
165
165
|
length autoexec $512;
|
|
166
166
|
autoexec=quote(urlencode(trim(getoption('autoexec'))));
|
|
167
167
|
put ',"AUTOEXEC" : ' autoexec;
|
|
168
|
+
length memsize $32;
|
|
168
169
|
memsize="%sysfunc(INPUTN(%sysfunc(getoption(memsize)), best.),sizekmg.)";
|
|
169
170
|
memsize=quote(cats(memsize));
|
|
170
171
|
put ',"MEMSIZE" : ' memsize;
|
|
@@ -589,8 +589,8 @@ data _null_;
|
|
|
589
589
|
put ' set &tempds; ';
|
|
590
590
|
put ' if not (upcase(name) =:"DATA"); /* ignore temp datasets */ ';
|
|
591
591
|
put ' i+1; ';
|
|
592
|
-
put ' call symputx(''wt''
|
|
593
|
-
put ' call symputx(''wtcnt'',i); ';
|
|
592
|
+
put ' call symputx(cats(''wt'',i),name,''l''); ';
|
|
593
|
+
put ' call symputx(''wtcnt'',i,''l''); ';
|
|
594
594
|
put ' data _null_; file &fref mod; put ",""WORK"":{"; ';
|
|
595
595
|
put ' %do i=1 %to &wtcnt; ';
|
|
596
596
|
put ' %let wt=&&wt&i; ';
|
|
@@ -628,6 +628,7 @@ data _null_;
|
|
|
628
628
|
put ' put '',"SYSVLONG" : '' sysvlong; ';
|
|
629
629
|
put ' put ",""SYSWARNINGTEXT"" : ""&syswarningtext"" "; ';
|
|
630
630
|
put ' put '',"END_DTTM" : "'' "%sysfunc(datetime(),datetime20.3)" ''" ''; ';
|
|
631
|
+
put ' length memsize $32; ';
|
|
631
632
|
put ' memsize="%sysfunc(INPUTN(%sysfunc(getoption(memsize)), best.),sizekmg.)"; ';
|
|
632
633
|
put ' memsize=quote(cats(memsize)); ';
|
|
633
634
|
put ' put '',"MEMSIZE" : '' memsize; ';
|
|
@@ -664,8 +665,10 @@ data _null_;
|
|
|
664
665
|
put '%global __program _program;';
|
|
665
666
|
put '%let _program=%sysfunc(coalescec(&__program,&_program));';
|
|
666
667
|
put ' ';
|
|
667
|
-
put '%macro webout(action,ds,dslabel=,fmt=,missing=NULL);';
|
|
668
|
-
put ' %mv_webout(&action,ds=&ds,dslabel=&dslabel,fmt=&fmt,missing=&missing
|
|
668
|
+
put '%macro webout(action,ds,dslabel=,fmt=,missing=NULL,showmeta=NO);';
|
|
669
|
+
put ' %mv_webout(&action,ds=&ds,dslabel=&dslabel,fmt=&fmt,missing=&missing';
|
|
670
|
+
put ' ,showmeta=&showmeta';
|
|
671
|
+
put ' )';
|
|
669
672
|
put '%mend;';
|
|
670
673
|
run;
|
|
671
674
|
|
package/viya/mv_jobflow.sas
CHANGED
|
@@ -272,7 +272,7 @@ data;run;%let jdswaitfor=&syslast;
|
|
|
272
272
|
data _null_;
|
|
273
273
|
infile &jfref lrecl=32767;
|
|
274
274
|
input;
|
|
275
|
-
jparams='jparams'
|
|
275
|
+
jparams=cats('jparams',symget('jid'));
|
|
276
276
|
call symputx(jparams,substr(_infile_,3,length(_infile_)-4));
|
|
277
277
|
run;
|
|
278
278
|
%local jobuid&jid;
|
package/viya/mv_webout.sas
CHANGED
|
@@ -187,8 +187,8 @@
|
|
|
187
187
|
set &tempds;
|
|
188
188
|
if not (upcase(name) =:"DATA"); /* ignore temp datasets */
|
|
189
189
|
i+1;
|
|
190
|
-
call symputx('wt'
|
|
191
|
-
call symputx('wtcnt',i);
|
|
190
|
+
call symputx(cats('wt',i),name,'l');
|
|
191
|
+
call symputx('wtcnt',i,'l');
|
|
192
192
|
data _null_; file &fref mod; put ",""WORK"":{";
|
|
193
193
|
%do i=1 %to &wtcnt;
|
|
194
194
|
%let wt=&&wt&i;
|
|
@@ -226,6 +226,7 @@
|
|
|
226
226
|
put ',"SYSVLONG" : ' sysvlong;
|
|
227
227
|
put ",""SYSWARNINGTEXT"" : ""&syswarningtext"" ";
|
|
228
228
|
put ',"END_DTTM" : "' "%sysfunc(datetime(),datetime20.3)" '" ';
|
|
229
|
+
length memsize $32;
|
|
229
230
|
memsize="%sysfunc(INPUTN(%sysfunc(getoption(memsize)), best.),sizekmg.)";
|
|
230
231
|
memsize=quote(cats(memsize));
|
|
231
232
|
put ',"MEMSIZE" : ' memsize;
|