@sasjs/core 4.3.0 → 4.4.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.
- package/README.md +2 -0
- package/base/mp_abort.sas +4 -1
- package/base/mp_ds2csv.sas +56 -7
- package/base/mp_filtervalidate.sas +1 -2
- package/base/mp_include.sas +4 -3
- package/base/mp_lockanytable.sas +1 -1
- package/base/mp_streamfile.sas +44 -34
- package/fcmp/mcf_getfmttype.sas +12 -4
- package/fcmp/mcf_length.sas +12 -5
- package/fcmp/mcf_stpsrv_header.sas +12 -5
- package/fcmp/mcf_string2file.sas +12 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -196,6 +196,8 @@ When contributing to this library, it is therefore important to ensure that all
|
|
|
196
196
|
We are currently on major release v4. Breaking changes should be marked with the [deprecated](https://www.doxygen.nl/manual/commands.html#cmddeprecated) doxygen tag. The following changes are planned when the next major (breaking) release becomes necessary:
|
|
197
197
|
|
|
198
198
|
* mp_testservice.sas to be renamed as mp_execute.sas (as it doesn't actually test anything)
|
|
199
|
+
* `insert_cmplib` option of mcf_xxx macros will be deprecated (the option is now checked automatically with value inserted only if needed)
|
|
200
|
+
* mcf_xxx macros to have `wrap=` option defaulted to YES for convenience
|
|
199
201
|
|
|
200
202
|
## Star Gazing
|
|
201
203
|
|
package/base/mp_abort.sas
CHANGED
|
@@ -66,7 +66,10 @@
|
|
|
66
66
|
%if %length(&mac)>0 %then %put NOTE- called by &mac;
|
|
67
67
|
%put NOTE - &msg;
|
|
68
68
|
|
|
69
|
-
%if %symexist(_SYSINCLUDEFILEDEVICE)
|
|
69
|
+
%if %symexist(_SYSINCLUDEFILEDEVICE)
|
|
70
|
+
/* abort cancel FILE does not restart outside the INCLUDE on Viya 3.5 */
|
|
71
|
+
and "&SYSPROCESSNAME " ne "Compute Server "
|
|
72
|
+
%then %do;
|
|
70
73
|
%if "*&_SYSINCLUDEFILEDEVICE*" ne "**" %then %do;
|
|
71
74
|
data &errds;
|
|
72
75
|
iftrue='1=1';
|
package/base/mp_ds2csv.sas
CHANGED
|
@@ -3,10 +3,28 @@
|
|
|
3
3
|
@brief Export a dataset to a CSV file WITH leading blanks
|
|
4
4
|
@details Export a dataset to a file or fileref, retaining leading blanks.
|
|
5
5
|
|
|
6
|
+
When using SASJS headerformat, the input statement is provided in the first
|
|
7
|
+
row of the CSV.
|
|
8
|
+
|
|
6
9
|
Usage:
|
|
7
10
|
|
|
8
11
|
%mp_ds2csv(sashelp.class,outref="%sysfunc(pathname(work))/file.csv")
|
|
9
12
|
|
|
13
|
+
filename example temp;
|
|
14
|
+
%mp_ds2csv(sashelp.air,outref=example,headerformat=SASJS)
|
|
15
|
+
data; infile example; input;put _infile_; if _n_>5 then stop;run;
|
|
16
|
+
|
|
17
|
+
data _null_;
|
|
18
|
+
infile example;
|
|
19
|
+
input;
|
|
20
|
+
call symputx('stmnt',_infile_);
|
|
21
|
+
stop;
|
|
22
|
+
run;
|
|
23
|
+
data work.want;
|
|
24
|
+
infile example dsd firstobs=2;
|
|
25
|
+
input &stmnt;
|
|
26
|
+
run;
|
|
27
|
+
|
|
10
28
|
Why use mp_ds2csv over, say, proc export?
|
|
11
29
|
|
|
12
30
|
1. Ability to retain leading blanks (this is a major one)
|
|
@@ -23,17 +41,24 @@
|
|
|
23
41
|
@li LABEL - Use the variable label (or name, if blank)
|
|
24
42
|
@li NAME - Use the variable name
|
|
25
43
|
@li SASJS - Used to create sasjs-formatted input CSVs, eg for use in
|
|
26
|
-
mp_testservice.sas
|
|
44
|
+
mp_testservice.sas. This format will supply an input statement in the
|
|
45
|
+
first row, making ingestion by datastep a breeze. Special misisng values
|
|
46
|
+
will be prefixed with a period (eg `.A`) to enable ingestion on both SAS 9
|
|
47
|
+
and Viya. Dates / Datetimes etc are identified by the format type (lookup
|
|
48
|
+
with mcf_getfmttype.sas) and converted to human readable formats (not
|
|
49
|
+
numbers).
|
|
27
50
|
@param [out] outfile= The output filename - should be quoted.
|
|
28
51
|
@param [out] outref= (0) The output fileref (takes precedence if provided)
|
|
29
|
-
@param [in] outencoding= (0) The output encoding to use
|
|
52
|
+
@param [in] outencoding= (0) The (quoted) output encoding to use, eg `"UTF-8"`
|
|
30
53
|
@param [in] termstr= (CRLF) The line seperator to use. For SASJS, will
|
|
31
54
|
always be CRLF. Valid values:
|
|
32
55
|
@li CRLF
|
|
33
56
|
@li LF
|
|
34
57
|
|
|
35
58
|
<h4> SAS Macros </h4>
|
|
59
|
+
@li mcf_getfmttype.sas
|
|
36
60
|
@li mf_getuniquename.sas
|
|
61
|
+
@li mf_getvarformat.sas
|
|
37
62
|
@li mf_getvarlist.sas
|
|
38
63
|
@li mf_getvartype.sas
|
|
39
64
|
|
|
@@ -50,7 +75,7 @@
|
|
|
50
75
|
,termstr=CRLF
|
|
51
76
|
)/*/STORE SOURCE*/;
|
|
52
77
|
|
|
53
|
-
%local outloc delim i varlist var vcnt vat dsv vcom vmiss;
|
|
78
|
+
%local outloc delim i varlist var vcnt vat dsv vcom vmiss fmttype vfmt;
|
|
54
79
|
|
|
55
80
|
%if not %sysfunc(exist(&ds)) %then %do;
|
|
56
81
|
%put %str(WARN)ING: &ds does not exist;
|
|
@@ -60,7 +85,7 @@
|
|
|
60
85
|
%if %index(&ds,.)=0 %then %let ds=WORK.&ds;
|
|
61
86
|
|
|
62
87
|
%if &outencoding=0 %then %let outencoding=;
|
|
63
|
-
%else %let outencoding=encoding
|
|
88
|
+
%else %let outencoding=encoding=&outencoding;
|
|
64
89
|
|
|
65
90
|
%if &outref=0 %then %let outloc=&outfile;
|
|
66
91
|
%else %let outloc=&outref;
|
|
@@ -68,6 +93,7 @@
|
|
|
68
93
|
%if &headerformat=SASJS %then %do;
|
|
69
94
|
%let delim=",";
|
|
70
95
|
%let termstr=CRLF;
|
|
96
|
+
%mcf_getfmttype(wrap=YES)
|
|
71
97
|
%end;
|
|
72
98
|
%else %if &dlm=COMMA %then %let delim=",";
|
|
73
99
|
%else %let delim=";";
|
|
@@ -77,7 +103,8 @@
|
|
|
77
103
|
/* first get headers */
|
|
78
104
|
data _null_;
|
|
79
105
|
file &outloc &outencoding lrecl=32767 termstr=&termstr;
|
|
80
|
-
length header $ 2000 varnm $32 dlm $1;
|
|
106
|
+
length header $ 2000 varnm vfmt $32 dlm $1 fmttype $8;
|
|
107
|
+
call missing(of _all_);
|
|
81
108
|
dsid=open("&ds.","i");
|
|
82
109
|
num=attrn(dsid,"nvars");
|
|
83
110
|
dlm=&delim;
|
|
@@ -92,7 +119,14 @@ data _null_;
|
|
|
92
119
|
%end;
|
|
93
120
|
%else %if &headerformat=SASJS %then %do;
|
|
94
121
|
if vartype(dsid,i)='C' then header=cats(varnm,':$char',varlen(dsid,i),'.');
|
|
95
|
-
else
|
|
122
|
+
else do;
|
|
123
|
+
vfmt=coalescec(varfmt(dsid,i),'0');
|
|
124
|
+
fmttype=mcf_getfmttype(vfmt);
|
|
125
|
+
if fmttype='DATE' then header=cats(varnm,':date9.');
|
|
126
|
+
else if fmttype='DATETIME' then header=cats(varnm,':E8601DT26.6');
|
|
127
|
+
else if fmttype='TIME' then header=cats(varnm,':TIME12.');
|
|
128
|
+
else header=cats(varnm,':best.');
|
|
129
|
+
end;
|
|
96
130
|
%end;
|
|
97
131
|
%else %do;
|
|
98
132
|
%put &sysmacroname: Invalid headerformat value (&headerformat);
|
|
@@ -147,14 +181,29 @@ data _null_;
|
|
|
147
181
|
%let vcom=;
|
|
148
182
|
%end;
|
|
149
183
|
%if %mf_getvartype(&ds,&var)=N %then %do;
|
|
184
|
+
%if &headerformat = SASJS %then %do;
|
|
185
|
+
%let vcom=&delim;
|
|
186
|
+
%let fmttype=%sysfunc(mcf_getfmttype(%mf_getvarformat(&ds,&var)0));
|
|
187
|
+
%if &fmttype=DATE %then %let vfmt=DATE9.;
|
|
188
|
+
%else %if &fmttype=DATETIME %then %let vfmt=E8601DT26.6;
|
|
189
|
+
%else %if &fmttype=TIME %then %let vfmt=TIME12.;
|
|
190
|
+
%else %do;
|
|
191
|
+
%let vfmt=;
|
|
192
|
+
%let vcom=;
|
|
193
|
+
%end;
|
|
194
|
+
%end;
|
|
195
|
+
%else %let vcom=;
|
|
196
|
+
|
|
150
197
|
/* must use period - in order to work in both 9.4 and Viya 3.5 */
|
|
151
198
|
if missing(&var) and &var ne %sysfunc(getoption(MISSING)) then do;
|
|
152
199
|
&vmiss=cats('.',&var);
|
|
153
200
|
put &vmiss &vat;
|
|
154
201
|
end;
|
|
155
|
-
else put &var &vat;
|
|
202
|
+
else put &var &vfmt &vcom &vat;
|
|
203
|
+
|
|
156
204
|
%end;
|
|
157
205
|
%else %do;
|
|
206
|
+
%if &i ne &vcnt %then %let vcom=&delim;
|
|
158
207
|
put &var &&vlen&i &vcom &vat;
|
|
159
208
|
%end;
|
|
160
209
|
%end;
|
package/base/mp_include.sas
CHANGED
|
@@ -51,9 +51,10 @@ https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/mcrolref/n1j5tcc0n2xczyn1
|
|
|
51
51
|
this dataset.
|
|
52
52
|
It will then run an abort cancel FILE to stop the include running, and pass
|
|
53
53
|
the dataset back.
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
54
|
+
|
|
55
|
+
IMPORTANT NOTE - it is NOT possible to read this dataset as part of _this_
|
|
56
|
+
macro! When running abort cancel FILE, ALL macros are closed, so instead it
|
|
57
|
+
is necessary to invoke "%mp_abort(mode=INCLUDE)" OUTSIDE of macro wrappers.
|
|
57
58
|
|
|
58
59
|
|
|
59
60
|
@version 9.4
|
package/base/mp_lockanytable.sas
CHANGED
|
@@ -85,7 +85,7 @@ run;
|
|
|
85
85
|
/* do not proceed if no observations can be processed */
|
|
86
86
|
%mp_abort(iftrue= (%sysfunc(getoption(OBS))=0)
|
|
87
87
|
,mac=&sysmacroname
|
|
88
|
-
,msg=%str(options obs = 0
|
|
88
|
+
,msg=%str(cannot continue when options obs = 0)
|
|
89
89
|
)
|
|
90
90
|
|
|
91
91
|
%if &ACTION=LOCK %then %do;
|
package/base/mp_streamfile.sas
CHANGED
|
@@ -12,17 +12,16 @@
|
|
|
12
12
|
|
|
13
13
|
%mp_streamfile(contenttype=csv,inloc=/some/where.txt,outname=myfile.txt)
|
|
14
14
|
|
|
15
|
+
@param [in] contenttype= (TEXTS) Either TEXT, ZIP, CSV, EXCEL
|
|
16
|
+
@param [in] inloc= /path/to/file.ext to be sent
|
|
17
|
+
@param [in] inref= fileref of file to be sent (if provided, overrides `inloc`)
|
|
18
|
+
@param [out] outname= the name of the file, as downloaded by the browser
|
|
19
|
+
|
|
15
20
|
<h4> SAS Macros </h4>
|
|
16
21
|
@li mf_getplatform.sas
|
|
17
22
|
@li mp_binarycopy.sas
|
|
18
23
|
|
|
19
|
-
@param contenttype= Either TEXT, ZIP, CSV, EXCEL (default TEXT)
|
|
20
|
-
@param inloc= /path/to/file.ext to be sent
|
|
21
|
-
@param inref= fileref of file to be sent (if provided, overrides `inloc`)
|
|
22
|
-
@param outname= the name of the file, as downloaded by the browser
|
|
23
|
-
|
|
24
24
|
@author Allan Bowe
|
|
25
|
-
@source https://github.com/sasjs/core
|
|
26
25
|
|
|
27
26
|
**/
|
|
28
27
|
|
|
@@ -48,16 +47,16 @@ data _null_;
|
|
|
48
47
|
if xengine='STREAM' then call symputx('streamweb',1,'l');
|
|
49
48
|
run;
|
|
50
49
|
|
|
51
|
-
%if &contentype=
|
|
50
|
+
%if &contentype=CSV %then %do;
|
|
52
51
|
%if &platform=SASMETA and &streamweb=1 %then %do;
|
|
53
52
|
data _null_;
|
|
54
|
-
rc=stpsrv_header('Content-type','application/
|
|
53
|
+
rc=stpsrv_header('Content-type','application/csv');
|
|
55
54
|
rc=stpsrv_header('Content-disposition',"attachment; filename=&outname");
|
|
56
55
|
run;
|
|
57
56
|
%end;
|
|
58
57
|
%else %if &platform=SASVIYA %then %do;
|
|
59
|
-
filename _webout filesrvc parenturi="&SYS_JES_JOB_URI" name='_webout.
|
|
60
|
-
contenttype='application/
|
|
58
|
+
filename _webout filesrvc parenturi="&SYS_JES_JOB_URI" name='_webout.txt'
|
|
59
|
+
contenttype='application/csv'
|
|
61
60
|
contentdisp="attachment; filename=&outname";
|
|
62
61
|
%end;
|
|
63
62
|
%end;
|
|
@@ -75,56 +74,67 @@ run;
|
|
|
75
74
|
contentdisp="attachment; filename=&outname";
|
|
76
75
|
%end;
|
|
77
76
|
%end;
|
|
78
|
-
%else %if &contentype=
|
|
77
|
+
%else %if &contentype=HTML %then %do;
|
|
78
|
+
%if &platform=SASVIYA %then %do;
|
|
79
|
+
filename _webout filesrvc parenturi="&SYS_JES_JOB_URI" name="_webout.json"
|
|
80
|
+
contenttype="text/html";
|
|
81
|
+
%end;
|
|
82
|
+
%end;
|
|
83
|
+
%else %if &contentype=TEXT %then %do;
|
|
79
84
|
%if &platform=SASMETA and &streamweb=1 %then %do;
|
|
80
85
|
data _null_;
|
|
81
|
-
rc=stpsrv_header('Content-type',
|
|
82
|
-
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
|
|
86
|
+
rc=stpsrv_header('Content-type','application/text');
|
|
83
87
|
rc=stpsrv_header('Content-disposition',"attachment; filename=&outname");
|
|
84
88
|
run;
|
|
85
89
|
%end;
|
|
86
90
|
%else %if &platform=SASVIYA %then %do;
|
|
87
|
-
filename _webout filesrvc parenturi="&SYS_JES_JOB_URI" name='_webout.
|
|
88
|
-
contenttype=
|
|
89
|
-
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
|
|
91
|
+
filename _webout filesrvc parenturi="&SYS_JES_JOB_URI" name='_webout.txt'
|
|
92
|
+
contenttype='application/text'
|
|
90
93
|
contentdisp="attachment; filename=&outname";
|
|
91
94
|
%end;
|
|
92
95
|
%end;
|
|
93
|
-
%else %
|
|
96
|
+
%else %do;
|
|
97
|
+
%put %str(ERR)OR: Content Type &contenttype NOT SUPPORTED by &sysmacroname!;
|
|
98
|
+
%return;
|
|
99
|
+
%end;
|
|
100
|
+
%else %if &contentype=WOFF or &contentype=WOFF2 or &contentype=TTF %then %do;
|
|
94
101
|
%if &platform=SASMETA and &streamweb=1 %then %do;
|
|
95
102
|
data _null_;
|
|
96
|
-
rc=stpsrv_header('Content-type',
|
|
97
|
-
rc=stpsrv_header('Content-disposition',"attachment; filename=&outname");
|
|
103
|
+
rc=stpsrv_header('Content-type',"font/%lowcase(&contenttype)");
|
|
98
104
|
run;
|
|
99
105
|
%end;
|
|
100
106
|
%else %if &platform=SASVIYA %then %do;
|
|
101
|
-
filename _webout filesrvc parenturi="&SYS_JES_JOB_URI"
|
|
102
|
-
contenttype=
|
|
103
|
-
contentdisp="attachment; filename=&outname";
|
|
107
|
+
filename _webout filesrvc parenturi="&SYS_JES_JOB_URI"
|
|
108
|
+
contenttype="font/%lowcase(&contenttype)";
|
|
104
109
|
%end;
|
|
105
110
|
%end;
|
|
106
|
-
%else %if &contentype=
|
|
111
|
+
%else %if &contentype=XLSX %then %do;
|
|
107
112
|
%if &platform=SASMETA and &streamweb=1 %then %do;
|
|
108
113
|
data _null_;
|
|
109
|
-
rc=stpsrv_header('Content-type',
|
|
114
|
+
rc=stpsrv_header('Content-type',
|
|
115
|
+
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
|
|
110
116
|
rc=stpsrv_header('Content-disposition',"attachment; filename=&outname");
|
|
111
117
|
run;
|
|
112
118
|
%end;
|
|
113
119
|
%else %if &platform=SASVIYA %then %do;
|
|
114
|
-
filename _webout filesrvc parenturi="&SYS_JES_JOB_URI" name='_webout.
|
|
115
|
-
contenttype=
|
|
120
|
+
filename _webout filesrvc parenturi="&SYS_JES_JOB_URI" name='_webout.xls'
|
|
121
|
+
contenttype=
|
|
122
|
+
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
|
|
116
123
|
contentdisp="attachment; filename=&outname";
|
|
117
124
|
%end;
|
|
118
125
|
%end;
|
|
119
|
-
%else %if &contentype=
|
|
120
|
-
%if &platform=
|
|
121
|
-
|
|
122
|
-
|
|
126
|
+
%else %if &contentype=ZIP %then %do;
|
|
127
|
+
%if &platform=SASMETA and &streamweb=1 %then %do;
|
|
128
|
+
data _null_;
|
|
129
|
+
rc=stpsrv_header('Content-type','application/zip');
|
|
130
|
+
rc=stpsrv_header('Content-disposition',"attachment; filename=&outname");
|
|
131
|
+
run;
|
|
132
|
+
%end;
|
|
133
|
+
%else %if &platform=SASVIYA %then %do;
|
|
134
|
+
filename _webout filesrvc parenturi="&SYS_JES_JOB_URI" name='_webout.zip'
|
|
135
|
+
contenttype='application/zip'
|
|
136
|
+
contentdisp="attachment; filename=&outname";
|
|
123
137
|
%end;
|
|
124
|
-
%end;
|
|
125
|
-
%else %do;
|
|
126
|
-
%put %str(ERR)OR: Content Type &contenttype NOT SUPPORTED by &sysmacroname!;
|
|
127
|
-
%return;
|
|
128
138
|
%end;
|
|
129
139
|
|
|
130
140
|
%if &inref ne 0 %then %do;
|
package/fcmp/mcf_getfmttype.sas
CHANGED
|
@@ -31,12 +31,12 @@
|
|
|
31
31
|
> fmt3=TIME
|
|
32
32
|
|
|
33
33
|
@param [out] wrap= (NO) Choose YES to add the proc fcmp wrapper.
|
|
34
|
-
@param [out] insert_cmplib= (NO) Choose YES to insert the package into the
|
|
35
|
-
CMPLIB reference.
|
|
36
34
|
@param [out] lib= (work) The output library in which to create the catalog.
|
|
37
35
|
@param [out] cat= (sasjs) The output catalog in which to create the package.
|
|
38
36
|
@param [out] pkg= (utils) The output package in which to create the function.
|
|
39
37
|
Uses a 3 part format: libref.catalog.package
|
|
38
|
+
@param [out] insert_cmplib= DEPRECATED - The CMPLIB option is checked and
|
|
39
|
+
values inserted only if needed.
|
|
40
40
|
|
|
41
41
|
<h4> SAS Macros </h4>
|
|
42
42
|
@li mcf_init.sas
|
|
@@ -51,11 +51,12 @@
|
|
|
51
51
|
**/
|
|
52
52
|
|
|
53
53
|
%macro mcf_getfmttype(wrap=NO
|
|
54
|
-
,insert_cmplib=
|
|
54
|
+
,insert_cmplib=DEPRECATED
|
|
55
55
|
,lib=WORK
|
|
56
56
|
,cat=SASJS
|
|
57
57
|
,pkg=UTILS
|
|
58
58
|
)/*/STORE SOURCE*/;
|
|
59
|
+
%local i var cmpval found;
|
|
59
60
|
|
|
60
61
|
%if %mcf_init(mcf_getfmttype)=1 %then %return;
|
|
61
62
|
|
|
@@ -103,7 +104,14 @@ endsub;
|
|
|
103
104
|
quit;
|
|
104
105
|
%end;
|
|
105
106
|
|
|
106
|
-
|
|
107
|
+
/* insert the CMPLIB if not already there */
|
|
108
|
+
%let cmpval=%sysfunc(getoption(cmplib));
|
|
109
|
+
%let found=0;
|
|
110
|
+
%do i=1 %to %sysfunc(countw(&cmpval,%str( %(%))));
|
|
111
|
+
%let var=%scan(&cmpval,&i,%str( %(%)));
|
|
112
|
+
%if &var=&lib..&cat %then %let found=1;
|
|
113
|
+
%end;
|
|
114
|
+
%if &found=0 %then %do;
|
|
107
115
|
options insert=(CMPLIB=(&lib..&cat));
|
|
108
116
|
%end;
|
|
109
117
|
|
package/fcmp/mcf_length.sas
CHANGED
|
@@ -32,12 +32,12 @@
|
|
|
32
32
|
> outa=3 outb=4 outc=5 outd=0
|
|
33
33
|
|
|
34
34
|
@param [out] wrap= (NO) Choose YES to add the proc fcmp wrapper.
|
|
35
|
-
@param [out] insert_cmplib= (NO) Choose YES to insert the package into the
|
|
36
|
-
CMPLIB reference.
|
|
37
35
|
@param [out] lib= (work) The output library in which to create the catalog.
|
|
38
36
|
@param [out] cat= (sasjs) The output catalog in which to create the package.
|
|
39
37
|
@param [out] pkg= (utils) The output package in which to create the function.
|
|
40
38
|
Uses a 3 part format: libref.catalog.package
|
|
39
|
+
@param [out] insert_cmplib= DEPRECATED - The CMPLIB option is checked and
|
|
40
|
+
values inserted only if needed.
|
|
41
41
|
|
|
42
42
|
<h4> SAS Macros </h4>
|
|
43
43
|
@li mcf_init.sas
|
|
@@ -49,12 +49,12 @@
|
|
|
49
49
|
**/
|
|
50
50
|
|
|
51
51
|
%macro mcf_length(wrap=NO
|
|
52
|
-
,insert_cmplib=
|
|
52
|
+
,insert_cmplib=DEPRECATED
|
|
53
53
|
,lib=WORK
|
|
54
54
|
,cat=SASJS
|
|
55
55
|
,pkg=UTILS
|
|
56
56
|
)/*/STORE SOURCE*/;
|
|
57
|
-
|
|
57
|
+
%local i var cmpval found;
|
|
58
58
|
%if %mcf_init(mcf_length)=1 %then %return;
|
|
59
59
|
|
|
60
60
|
%if &wrap=YES %then %do;
|
|
@@ -76,7 +76,14 @@ endsub;
|
|
|
76
76
|
quit;
|
|
77
77
|
%end;
|
|
78
78
|
|
|
79
|
-
|
|
79
|
+
/* insert the CMPLIB if not already there */
|
|
80
|
+
%let cmpval=%sysfunc(getoption(cmplib));
|
|
81
|
+
%let found=0;
|
|
82
|
+
%do i=1 %to %sysfunc(countw(&cmpval,%str( %(%))));
|
|
83
|
+
%let var=%scan(&cmpval,&i,%str( %(%)));
|
|
84
|
+
%if &var=&lib..&cat %then %let found=1;
|
|
85
|
+
%end;
|
|
86
|
+
%if &found=0 %then %do;
|
|
80
87
|
options insert=(CMPLIB=(&lib..&cat));
|
|
81
88
|
%end;
|
|
82
89
|
|
|
@@ -47,12 +47,12 @@
|
|
|
47
47
|
|
|
48
48
|
|
|
49
49
|
@param [out] wrap= (NO) Choose YES to add the proc fcmp wrapper.
|
|
50
|
-
@param [out] insert_cmplib= (NO) Choose YES to insert the package into the
|
|
51
|
-
CMPLIB reference.
|
|
52
50
|
@param [out] lib= (work) The output library in which to create the catalog.
|
|
53
51
|
@param [out] cat= (sasjs) The output catalog in which to create the package.
|
|
54
52
|
@param [out] pkg= (utils) The output package in which to create the function.
|
|
55
53
|
Uses a 3 part format: libref.catalog.package
|
|
54
|
+
@param [out] insert_cmplib= DEPRECATED - The CMPLIB option is checked and
|
|
55
|
+
values inserted only if needed.
|
|
56
56
|
|
|
57
57
|
<h4> SAS Macros </h4>
|
|
58
58
|
@li mcf_init.sas
|
|
@@ -64,12 +64,12 @@
|
|
|
64
64
|
**/
|
|
65
65
|
|
|
66
66
|
%macro mcf_stpsrv_header(wrap=NO
|
|
67
|
-
,insert_cmplib=
|
|
67
|
+
,insert_cmplib=DEPRECATED
|
|
68
68
|
,lib=WORK
|
|
69
69
|
,cat=SASJS
|
|
70
70
|
,pkg=UTILS
|
|
71
71
|
)/*/STORE SOURCE*/;
|
|
72
|
-
|
|
72
|
+
%local i var cmpval found;
|
|
73
73
|
%if %mcf_init(stpsrv_header)=1 %then %return;
|
|
74
74
|
|
|
75
75
|
%if &wrap=YES %then %do;
|
|
@@ -96,7 +96,14 @@ endsub;
|
|
|
96
96
|
quit;
|
|
97
97
|
%end;
|
|
98
98
|
|
|
99
|
-
|
|
99
|
+
/* insert the CMPLIB if not already there */
|
|
100
|
+
%let cmpval=%sysfunc(getoption(cmplib));
|
|
101
|
+
%let found=0;
|
|
102
|
+
%do i=1 %to %sysfunc(countw(&cmpval,%str( %(%))));
|
|
103
|
+
%let var=%scan(&cmpval,&i,%str( %(%)));
|
|
104
|
+
%if &var=&lib..&cat %then %let found=1;
|
|
105
|
+
%end;
|
|
106
|
+
%if &found=0 %then %do;
|
|
100
107
|
options insert=(CMPLIB=(&lib..&cat));
|
|
101
108
|
%end;
|
|
102
109
|
|
package/fcmp/mcf_string2file.sas
CHANGED
|
@@ -32,12 +32,12 @@
|
|
|
32
32
|
run;
|
|
33
33
|
|
|
34
34
|
@param [out] wrap= (NO) Choose YES to add the proc fcmp wrapper.
|
|
35
|
-
@param [out] insert_cmplib= (NO) Choose YES to insert the package into the
|
|
36
|
-
CMPLIB reference.
|
|
37
35
|
@param [out] lib= (work) The output library in which to create the catalog.
|
|
38
36
|
@param [out] cat= (sasjs) The output catalog in which to create the package.
|
|
39
37
|
@param [out] pkg= (utils) The output package in which to create the function.
|
|
40
38
|
Uses a 3 part format: libref.catalog.package
|
|
39
|
+
@param [out] insert_cmplib= DEPRECATED - The CMPLIB option is checked and
|
|
40
|
+
values inserted only if needed.
|
|
41
41
|
|
|
42
42
|
<h4> SAS Macros </h4>
|
|
43
43
|
@li mcf_init.sas
|
|
@@ -49,12 +49,12 @@
|
|
|
49
49
|
**/
|
|
50
50
|
|
|
51
51
|
%macro mcf_string2file(wrap=NO
|
|
52
|
-
,insert_cmplib=
|
|
52
|
+
,insert_cmplib=DEPRECATED
|
|
53
53
|
,lib=WORK
|
|
54
54
|
,cat=SASJS
|
|
55
55
|
,pkg=UTILS
|
|
56
56
|
)/*/STORE SOURCE*/;
|
|
57
|
-
|
|
57
|
+
%local i var cmpval found;
|
|
58
58
|
%if %mcf_init(mcf_string2file)=1 %then %return;
|
|
59
59
|
|
|
60
60
|
%if &wrap=YES %then %do;
|
|
@@ -81,7 +81,14 @@ endsub;
|
|
|
81
81
|
quit;
|
|
82
82
|
%end;
|
|
83
83
|
|
|
84
|
-
|
|
84
|
+
/* insert the CMPLIB if not already there */
|
|
85
|
+
%let cmpval=%sysfunc(getoption(cmplib));
|
|
86
|
+
%let found=0;
|
|
87
|
+
%do i=1 %to %sysfunc(countw(&cmpval,%str( %(%))));
|
|
88
|
+
%let var=%scan(&cmpval,&i,%str( %(%)));
|
|
89
|
+
%if &var=&lib..&cat %then %let found=1;
|
|
90
|
+
%end;
|
|
91
|
+
%if &found=0 %then %do;
|
|
85
92
|
options insert=(CMPLIB=(&lib..&cat));
|
|
86
93
|
%end;
|
|
87
94
|
|
package/package.json
CHANGED