@sasjs/core 2.56.3 → 2.57.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/mf_existfeature.sas +1 -1
- package/base/mf_getattrc.sas +1 -1
- package/base/mf_getattrn.sas +1 -1
- package/base/mf_mkdir.sas +1 -1
- package/base/mf_nobs.sas +1 -1
- package/base/mp_copyfolder.sas +4 -2
- package/base/mp_ds2fmtds.sas +11 -4
- package/base/mp_ds2inserts.sas +1 -0
- package/base/mp_filtervalidate.sas +2 -2
- package/base/mp_getconstraints.sas +3 -3
- package/base/mp_getddl.sas +1 -1
- package/base/mp_init.sas +22 -11
- package/base/mp_jsonout.sas +1 -1
- package/base/mp_lockanytable.sas +1 -1
- package/meta/mm_createwebservice.sas +1 -1
- package/package.json +1 -1
- package/viya/mv_createwebservice.sas +1 -1
- package/viya/mv_getfoldermembers.sas +1 -0
- package/viya/mv_jobwaitfor.sas +1 -0
package/base/mf_existfeature.sas
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
Run without arguments to see a list of detectable features.
|
|
6
6
|
Note - this list is based on known versions of SAS rather than
|
|
7
7
|
actual feature detection, as that is tricky / impossible to do
|
|
8
|
-
without generating
|
|
8
|
+
without generating errs in most cases.
|
|
9
9
|
|
|
10
10
|
%put %mf_existfeature(PROCLUA);
|
|
11
11
|
|
package/base/mf_getattrc.sas
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
@param attr full list in [documentation](
|
|
11
11
|
https://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000147794.htm)
|
|
12
12
|
@return output returns result of the attrc value supplied, or -1 and log
|
|
13
|
-
message if
|
|
13
|
+
message if err.
|
|
14
14
|
|
|
15
15
|
@version 9.2
|
|
16
16
|
@author Allan Bowe
|
package/base/mf_getattrn.sas
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
@param attr Common values are NLOBS and NVARS, full list in [documentation](
|
|
11
11
|
http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000212040.htm)
|
|
12
12
|
@return output returns result of the attrn value supplied, or -1 and log
|
|
13
|
-
message if
|
|
13
|
+
message if err.
|
|
14
14
|
|
|
15
15
|
@version 9.2
|
|
16
16
|
@author Allan Bowe
|
package/base/mf_mkdir.sas
CHANGED
package/base/mf_nobs.sas
CHANGED
package/base/mp_copyfolder.sas
CHANGED
|
@@ -55,6 +55,8 @@
|
|
|
55
55
|
/* create folders and copy content */
|
|
56
56
|
data _null_;
|
|
57
57
|
set work.&tempds;
|
|
58
|
+
length msg $256;
|
|
59
|
+
call missing(msg);
|
|
58
60
|
if _n_ = 1 then dpos+sum(length(directory),2);
|
|
59
61
|
filepath2="&target/"!!substr(filepath,dpos);
|
|
60
62
|
if file_or_folder='folder' then call execute('%mf_mkdir('!!filepath2!!')');
|
|
@@ -63,9 +65,9 @@
|
|
|
63
65
|
rc1=filename(fref1,filepath,'disk','recfm=n');
|
|
64
66
|
rc2=filename(fref2,filepath2,'disk','recfm=n');
|
|
65
67
|
if fcopy(fref1,fref2) ne 0 then do;
|
|
66
|
-
|
|
68
|
+
msg=sysmsg();
|
|
67
69
|
putlog "%str(ERR)OR: Unable to copy " filepath " to " filepath2;
|
|
68
|
-
putlog
|
|
70
|
+
putlog msg=;
|
|
69
71
|
end;
|
|
70
72
|
end;
|
|
71
73
|
rc=filename(fref1);
|
package/base/mp_ds2fmtds.sas
CHANGED
|
@@ -1,16 +1,22 @@
|
|
|
1
1
|
/**
|
|
2
2
|
@file
|
|
3
|
-
@brief Converts every value in a dataset to
|
|
3
|
+
@brief Converts every value in a dataset to formatted value
|
|
4
4
|
@details Converts every value to it's formatted value. All variables will
|
|
5
|
-
become character, and will be in the same order.
|
|
5
|
+
become character, and will be in the same order as the original dataset.
|
|
6
|
+
|
|
7
|
+
Lengths will be adjusted according to the format lengths, where applicable.
|
|
6
8
|
|
|
7
9
|
Usage:
|
|
8
10
|
|
|
9
11
|
%mp_ds2fmtds(sashelp.cars,work.cars)
|
|
12
|
+
%mp_ds2fmtds(sashelp.vallopt,vw_vallopt)
|
|
10
13
|
|
|
11
14
|
@param [in] libds The library.dataset to be converted
|
|
12
15
|
@param [out] outds The dataset to create.
|
|
13
16
|
|
|
17
|
+
<h4> SAS Macros </h4>
|
|
18
|
+
@li mf_existds.sas
|
|
19
|
+
|
|
14
20
|
<h4> Related Macros <h4>
|
|
15
21
|
@li mp_jsonout.sas
|
|
16
22
|
|
|
@@ -22,8 +28,9 @@
|
|
|
22
28
|
)/*/STORE SOURCE*/;
|
|
23
29
|
|
|
24
30
|
/* validations */
|
|
25
|
-
|
|
26
|
-
|
|
31
|
+
|
|
32
|
+
%if not %mf_existds(libds=&libds) %then %do;
|
|
33
|
+
%put %str(WARN)ING: &libds does not exist as either a VIEW or DATASET;
|
|
27
34
|
%return;
|
|
28
35
|
%end;
|
|
29
36
|
%if %index(&libds,.)=0 %then %let libds=WORK.&libds;
|
package/base/mp_ds2inserts.sas
CHANGED
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
@param [in] targetds The target dataset against which to verify the query
|
|
34
34
|
@param [out] abort= (YES) If YES will call mp_abort.sas on any exceptions
|
|
35
35
|
@param [out] outds= (work.mp_filtervalidate) Output dataset containing the
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
err / warning message, if one exists. If this table contains any rows,
|
|
37
|
+
there are problems!
|
|
38
38
|
|
|
39
39
|
<h4> SAS Macros </h4>
|
|
40
40
|
@li mf_getuniquefileref.sas
|
|
@@ -48,17 +48,17 @@
|
|
|
48
48
|
%let vw=%mf_getuniquename(prefix=mp_getconstraints_vw_);
|
|
49
49
|
data &vw /view=&vw;
|
|
50
50
|
set sashelp.vcncolu;
|
|
51
|
-
where
|
|
51
|
+
where table_catalog="&lib";
|
|
52
52
|
|
|
53
53
|
/* use retain approach to reset the constraint order with each constraint */
|
|
54
54
|
length tmp $1000;
|
|
55
55
|
retain tmp;
|
|
56
56
|
drop tmp;
|
|
57
|
-
if tmp ne catx('|',
|
|
57
|
+
if tmp ne catx('|',table_catalog,table_name,constraint_name) then do;
|
|
58
58
|
constraint_order=1;
|
|
59
59
|
end;
|
|
60
60
|
else constraint_order+1;
|
|
61
|
-
tmp=catx('|',
|
|
61
|
+
tmp=catx('|',table_catalog, table_name,constraint_name);
|
|
62
62
|
run;
|
|
63
63
|
|
|
64
64
|
/* must use SQL as proc datasets does not support length changes */
|
package/base/mp_getddl.sas
CHANGED
package/base/mp_init.sas
CHANGED
|
@@ -1,15 +1,25 @@
|
|
|
1
1
|
/**
|
|
2
2
|
@file
|
|
3
3
|
@brief Initialise session with useful settings and variables
|
|
4
|
-
@details Implements a set of
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
SAS-Powered applications elsewhere.
|
|
4
|
+
@details Implements a "strict" set of SAS options for use in defensive
|
|
5
|
+
programming. Highly recommended, if you want your code to run on some
|
|
6
|
+
other machine.
|
|
8
7
|
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
This macro is recommended to be compiled and invoked in the `initProgram`
|
|
9
|
+
for SASjs [Jobs](https://cli.sasjs.io/sasjsconfig.html#jobConfig_initProgram
|
|
10
|
+
), [Services](
|
|
11
|
+
https://cli.sasjs.io/sasjsconfig.html#serviceConfig_initProgram) and [Tests]
|
|
12
|
+
(https://cli.sasjs.io/sasjsconfig.html#testConfig_initProgram).
|
|
11
13
|
|
|
12
|
-
|
|
14
|
+
For non SASjs projects, you could invoke in the autoexec, or in your own
|
|
15
|
+
solution initialisation macro.
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
If you have a good idea for another useful option, setting, or global
|
|
19
|
+
variable - feel free to [raise an issue](
|
|
20
|
+
https://github.com/sasjs/core/issues/new)!
|
|
21
|
+
|
|
22
|
+
All global variables are prefixed with "SASJS" (unless modified with the
|
|
13
23
|
prefix parameter).
|
|
14
24
|
|
|
15
25
|
@param [in] prefix= (SASJS) The prefix to apply to the global macro variables
|
|
@@ -39,15 +49,16 @@
|
|
|
39
49
|
autocorrect /* disallow mis-spelled procedure names */
|
|
40
50
|
compress=CHAR /* default is none so ensure we have something! */
|
|
41
51
|
datastmtchk=ALLKEYWORDS /* protection from overwriting input datasets */
|
|
42
|
-
|
|
43
|
-
fmterr /* ensure err
|
|
44
|
-
mergenoby=%str(ERR)OR /*
|
|
45
|
-
missing=.
|
|
52
|
+
%str(err)orcheck=STRICT /* catch errs in libname/filename statements */
|
|
53
|
+
fmterr /* ensure err when a format cannot be found */
|
|
54
|
+
mergenoby=%str(ERR)OR /* throw err when a merge has no BY variables */
|
|
55
|
+
missing=. /* changing this can cause hard to detect errs */
|
|
46
56
|
noquotelenmax /* avoid warnings for long strings */
|
|
47
57
|
noreplace /* avoid overwriting permanent datasets */
|
|
48
58
|
ps=max /* reduce log size slightly */
|
|
49
59
|
validmemname=COMPATIBLE /* avoid special characters etc in table names */
|
|
50
60
|
validvarname=V7 /* avoid special characters etc in variable names */
|
|
61
|
+
varinitchk=%str(ERR)OR /* avoid data mistakes from variable name typos */
|
|
51
62
|
varlenchk=%str(ERR)OR /* fail hard if truncation (data loss) can result */
|
|
52
63
|
;
|
|
53
64
|
|
package/base/mp_jsonout.sas
CHANGED
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
%if &action=OPEN %then %do;
|
|
64
64
|
options nobomfile;
|
|
65
65
|
data _null_;file &jref encoding='utf-8';
|
|
66
|
-
put '{"
|
|
66
|
+
put '{"PROCESSED_DTTM" : "' "%sysfunc(datetime(),E8601DT26.6)" '"';
|
|
67
67
|
run;
|
|
68
68
|
%end;
|
|
69
69
|
%else %if (&action=ARR or &action=OBJ) %then %do;
|
package/base/mp_lockanytable.sas
CHANGED
|
@@ -239,7 +239,7 @@ run;
|
|
|
239
239
|
%let abortme=1;
|
|
240
240
|
%end;
|
|
241
241
|
|
|
242
|
-
/* catch
|
|
242
|
+
/* catch errs - mp_abort must be called outside of a logic block */
|
|
243
243
|
%mp_abort(iftrue=(&abortme=1),
|
|
244
244
|
msg=%superq(msg),
|
|
245
245
|
mac=&sysmacroname
|
|
@@ -95,7 +95,7 @@ data _null_;
|
|
|
95
95
|
put '%if &action=OPEN %then %do; ';
|
|
96
96
|
put ' options nobomfile; ';
|
|
97
97
|
put ' data _null_;file &jref encoding=''utf-8''; ';
|
|
98
|
-
put ' put ''{"
|
|
98
|
+
put ' put ''{"PROCESSED_DTTM" : "'' "%sysfunc(datetime(),E8601DT26.6)" ''"''; ';
|
|
99
99
|
put ' run; ';
|
|
100
100
|
put '%end; ';
|
|
101
101
|
put '%else %if (&action=ARR or &action=OBJ) %then %do; ';
|
package/package.json
CHANGED
|
@@ -243,7 +243,7 @@ data _null_;
|
|
|
243
243
|
put '%if &action=OPEN %then %do; ';
|
|
244
244
|
put ' options nobomfile; ';
|
|
245
245
|
put ' data _null_;file &jref encoding=''utf-8''; ';
|
|
246
|
-
put ' put ''{"
|
|
246
|
+
put ' put ''{"PROCESSED_DTTM" : "'' "%sysfunc(datetime(),E8601DT26.6)" ''"''; ';
|
|
247
247
|
put ' run; ';
|
|
248
248
|
put '%end; ';
|
|
249
249
|
put '%else %if (&action=ARR or &action=OBJ) %then %do; ';
|