@sasjs/core 3.12.0 → 4.3.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/README.md +7 -5
- package/base/mf_abort.sas +1 -1
- package/base/mf_dedup.sas +0 -1
- package/base/mf_existvar.sas +4 -4
- package/base/mf_getfilesize.sas +31 -14
- package/base/mf_wordsinstr1andstr2.sas +0 -1
- package/base/mf_wordsinstr1butnotstr2.sas +5 -5
- package/base/mp_abort.sas +3 -2
- package/base/mp_assertdsobs.sas +8 -9
- package/base/mp_assertscope.sas +39 -14
- package/base/mp_coretable.sas +27 -1
- package/base/mp_createwebservice.sas +10 -8
- package/base/mp_csv2ds.sas +0 -4
- package/base/mp_deletefolder.sas +1 -0
- package/base/mp_dirlist.sas +9 -2
- package/base/mp_ds2csv.sas +119 -14
- package/base/mp_ds2squeeze.sas +120 -0
- package/base/mp_getmaxvarlengths.sas +51 -18
- package/base/mp_guesspk.sas +245 -225
- package/base/mp_init.sas +39 -32
- package/base/mp_jsonout.sas +9 -6
- package/base/mp_stackdiffs.sas +592 -0
- package/base/mp_storediffs.sas +11 -29
- package/base/mp_testservice.sas +25 -11
- package/fcmp/mcf_getfmttype.sas +110 -0
- package/fcmp/mcf_init.sas +44 -0
- package/fcmp/mcf_length.sas +9 -3
- package/fcmp/mcf_stpsrv_header.sas +6 -2
- package/fcmp/mcf_string2file.sas +9 -0
- package/meta/mm_createstp.sas +1 -0
- package/meta/mm_createwebservice.sas +10 -7
- package/meta/mm_getgroupmembers.sas +15 -8
- package/meta/mm_getservercontexts.sas +11 -4
- package/meta/mm_updatestpsourcecode.sas +0 -11
- package/meta/mm_webout.sas +1 -1
- package/package.json +1 -1
- package/server/ms_webout.sas +1 -1
- package/viya/mv_createwebservice.sas +10 -7
- package/viya/mv_deletefoldermember.sas +1 -0
- package/viya/mv_deletejes.sas +1 -0
- package/viya/mv_webout.sas +1 -1
- package/viya/mv_getaccesstoken.sas +0 -32
- package/viya/mv_getapptoken.sas +0 -23
- package/viya/mv_getrefreshtoken.sas +0 -33
package/base/mp_testservice.sas
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
@file
|
|
3
|
-
@brief Will execute a
|
|
2
|
+
@file
|
|
3
|
+
@brief Will execute a SASjs web service on SAS 9 or Viya
|
|
4
4
|
@details Prepares the input files and retrieves the resulting datasets from
|
|
5
5
|
the response JSON.
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
duration=60*5
|
|
9
|
-
)
|
|
7
|
+
|
|
10
8
|
|
|
11
9
|
Note - the _webout fileref should NOT be assigned prior to running this macro.
|
|
12
10
|
|
|
@@ -14,6 +12,10 @@
|
|
|
14
12
|
@param [in] inputfiles=(0) A list of space seperated fileref:filename pairs as
|
|
15
13
|
follows:
|
|
16
14
|
inputfiles=inref:filename inref2:filename2
|
|
15
|
+
@param [in] inputdatasets= (0) All datasets in this space seperated list are
|
|
16
|
+
converted into SASJS-formatted CSVs (see mp_ds2csv.sas) files and added to
|
|
17
|
+
the list of `inputfiles` for ingestion. The dataset will be sent with the
|
|
18
|
+
same name (no need for a colon modifier).
|
|
17
19
|
@param [in] inputparams=(0) A dataset containing name/value pairs in the
|
|
18
20
|
following format:
|
|
19
21
|
|name:$32|value:$1000|
|
|
@@ -38,9 +40,13 @@
|
|
|
38
40
|
@li mf_getuniquename.sas
|
|
39
41
|
@li mp_abort.sas
|
|
40
42
|
@li mp_binarycopy.sas
|
|
43
|
+
@li mp_ds2csv.sas
|
|
41
44
|
@li mv_getjobresult.sas
|
|
42
45
|
@li mv_jobflow.sas
|
|
43
46
|
|
|
47
|
+
<h4> Related Programs </h4>
|
|
48
|
+
@li mp_testservice.test.sas
|
|
49
|
+
|
|
44
50
|
@version 9.4
|
|
45
51
|
@author Allan Bowe
|
|
46
52
|
|
|
@@ -48,6 +54,7 @@
|
|
|
48
54
|
|
|
49
55
|
%macro mp_testservice(program,
|
|
50
56
|
inputfiles=0,
|
|
57
|
+
inputdatasets=0,
|
|
51
58
|
inputparams=0,
|
|
52
59
|
debug=log,
|
|
53
60
|
mdebug=0,
|
|
@@ -56,7 +63,7 @@
|
|
|
56
63
|
viyaresult=WEBOUT_JSON,
|
|
57
64
|
viyacontext=SAS Job Execution compute context
|
|
58
65
|
)/*/STORE SOURCE*/;
|
|
59
|
-
%local dbg;
|
|
66
|
+
%local dbg pcnt fref1 webref i webcount var platform;
|
|
60
67
|
%if &mdebug=1 %then %do;
|
|
61
68
|
%put &sysmacroname entry vars:;
|
|
62
69
|
%put _local_;
|
|
@@ -64,7 +71,6 @@
|
|
|
64
71
|
%else %let dbg=*;
|
|
65
72
|
|
|
66
73
|
/* sanitise inputparams */
|
|
67
|
-
%local pcnt;
|
|
68
74
|
%let pcnt=0;
|
|
69
75
|
%if &inputparams ne 0 %then %do;
|
|
70
76
|
data _null_;
|
|
@@ -86,17 +92,25 @@
|
|
|
86
92
|
)
|
|
87
93
|
%end;
|
|
88
94
|
|
|
95
|
+
/* convert inputdatasets to filerefs */
|
|
96
|
+
%if "&inputdatasets" ne "0" %then %do;
|
|
97
|
+
%if %quote(&inputfiles)=0 %then %let inputfiles=;
|
|
98
|
+
%do i=1 %to %sysfunc(countw(&inputdatasets,%str( )));
|
|
99
|
+
%let var=%scan(&inputdatasets,&i,%str( ));
|
|
100
|
+
%local dsref&i;
|
|
101
|
+
%let dsref&i=%mf_getuniquefileref();
|
|
102
|
+
%mp_ds2csv(&var,outref=&&dsref&i,headerformat=SASJS)
|
|
103
|
+
%let inputfiles=&inputfiles &&dsref&i:%scan(&var,-1,.);
|
|
104
|
+
%end;
|
|
105
|
+
%end;
|
|
106
|
+
|
|
89
107
|
|
|
90
|
-
%local fref1 webref;
|
|
91
108
|
%let fref1=%mf_getuniquefileref();
|
|
92
109
|
%let webref=%mf_getuniquefileref();
|
|
93
|
-
|
|
94
|
-
%local platform;
|
|
95
110
|
%let platform=%mf_getplatform();
|
|
96
111
|
%if &platform=SASMETA %then %do;
|
|
97
112
|
|
|
98
113
|
/* parse the input files */
|
|
99
|
-
%local webcount i var;
|
|
100
114
|
%if %quote(&inputfiles) ne 0 %then %do;
|
|
101
115
|
%let webcount=%sysfunc(countw(&inputfiles));
|
|
102
116
|
%put &=webcount;
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
@file
|
|
3
|
+
@brief Returns the type of the format
|
|
4
|
+
@details
|
|
5
|
+
Returns the type, eg DATE / DATETIME / TIME (based on hard-coded lookup)
|
|
6
|
+
else CHAR / NUM.
|
|
7
|
+
|
|
8
|
+
This macro may be extended in the future to support custom formats - this
|
|
9
|
+
would necessitate a call to `dosubl()` for running a proc format with cntlout.
|
|
10
|
+
|
|
11
|
+
The function itself takes the following (positional) parameters:
|
|
12
|
+
|
|
13
|
+
| PARAMETER | DESCRIPTION |
|
|
14
|
+
|---|---|
|
|
15
|
+
|fmtnm| Format name to be tested. Can be with or without the w.d extension.|
|
|
16
|
+
|
|
17
|
+
Usage:
|
|
18
|
+
|
|
19
|
+
%mcf_getfmttype(wrap=YES, insert_cmplib=YES)
|
|
20
|
+
|
|
21
|
+
data _null_;
|
|
22
|
+
fmt1=mcf_getfmttype('DATE9.');
|
|
23
|
+
fmt2=mcf_getfmttype('DATETIME');
|
|
24
|
+
put (fmt:)(=);
|
|
25
|
+
run;
|
|
26
|
+
%put fmt3=%sysfunc(mcf_getfmttype(TIME9.));
|
|
27
|
+
|
|
28
|
+
Returns:
|
|
29
|
+
|
|
30
|
+
> fmt1=DATE fmt2=DATETIME
|
|
31
|
+
> fmt3=TIME
|
|
32
|
+
|
|
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
|
+
@param [out] lib= (work) The output library in which to create the catalog.
|
|
37
|
+
@param [out] cat= (sasjs) The output catalog in which to create the package.
|
|
38
|
+
@param [out] pkg= (utils) The output package in which to create the function.
|
|
39
|
+
Uses a 3 part format: libref.catalog.package
|
|
40
|
+
|
|
41
|
+
<h4> SAS Macros </h4>
|
|
42
|
+
@li mcf_init.sas
|
|
43
|
+
|
|
44
|
+
<h4> Related Programs </h4>
|
|
45
|
+
@li mcf_getfmttype.test.sas
|
|
46
|
+
@li mp_init.sas
|
|
47
|
+
|
|
48
|
+
@todo "Custom Format Lookups" To enable site-specific formats, make
|
|
49
|
+
use of a set of SASJS_FMTLIST_(DATATYPE) global variables.
|
|
50
|
+
|
|
51
|
+
**/
|
|
52
|
+
|
|
53
|
+
%macro mcf_getfmttype(wrap=NO
|
|
54
|
+
,insert_cmplib=NO
|
|
55
|
+
,lib=WORK
|
|
56
|
+
,cat=SASJS
|
|
57
|
+
,pkg=UTILS
|
|
58
|
+
)/*/STORE SOURCE*/;
|
|
59
|
+
|
|
60
|
+
%if %mcf_init(mcf_getfmttype)=1 %then %return;
|
|
61
|
+
|
|
62
|
+
%if &wrap=YES %then %do;
|
|
63
|
+
proc fcmp outlib=&lib..&cat..&pkg;
|
|
64
|
+
%end;
|
|
65
|
+
|
|
66
|
+
function mcf_getfmttype(fmtnm $) $8;
|
|
67
|
+
if substr(fmtnm,1,1)='$' then return('CHAR');
|
|
68
|
+
else do;
|
|
69
|
+
/* extract NAME */
|
|
70
|
+
length fmt $32;
|
|
71
|
+
fmt=scan(fmtnm,1,'.');
|
|
72
|
+
do while (
|
|
73
|
+
substr(fmt,length(fmt),1) in ('1','2','3','4','5','6','7','8','9','0')
|
|
74
|
+
);
|
|
75
|
+
if length(fmt)=1 then fmt='W';
|
|
76
|
+
else fmt=substr(fmt,1,length(fmt)-1);
|
|
77
|
+
end;
|
|
78
|
+
|
|
79
|
+
/* apply lookups */
|
|
80
|
+
if cats(fmt) in ('DATETIME','B8601DN','B8601DN','B8601DT','B8601DT'
|
|
81
|
+
,'B8601DZ','B8601DZ','DATEAMPM','DTDATE','DTMONYY','DTWKDATX','DTYEAR'
|
|
82
|
+
,'DTYYQC','E8601DN','E8601DN','E8601DT','E8601DT','E8601DZ','E8601DZ')
|
|
83
|
+
then return('DATETIME');
|
|
84
|
+
else if fmt in ('DATE','YYMMDD','B8601DA','B8601DA','DAY','DDMMYY'
|
|
85
|
+
,'DDMMYYB','DDMMYYC','DDMMYYD','DDMMYYN','DDMMYYP','DDMMYYS','DDMMYYx'
|
|
86
|
+
,'DOWNAME','E8601DA','E8601DA','JULDAY','JULIAN','MMDDYY','MMDDYYB'
|
|
87
|
+
,'MMDDYYC','MMDDYYD','MMDDYYN','MMDDYYP','MMDDYYS','MMDDYYx','MMYY'
|
|
88
|
+
,'MMYYC','MMYYD','MMYYN','MMYYP','MMYYS','MMYYx','MONNAME','MONTH'
|
|
89
|
+
,'MONYY','PDJULG','PDJULI','QTR','QTRR','WEEKDATE','WEEKDATX','WEEKDAY'
|
|
90
|
+
,'WEEKU','WEEKV','WEEKW','WORDDATE','WORDDATX','YEAR','YYMM','YYMMC'
|
|
91
|
+
,'YYMMD','YYMMDDB','YYMMDDC','YYMMDDD','YYMMDDN','YYMMDDP','YYMMDDS'
|
|
92
|
+
,'YYMMDDx','YYMMN','YYMMP','YYMMS','YYMMx','YYMON','YYQ','YYQC','YYQD'
|
|
93
|
+
,'YYQN','YYQP','YYQR','YYQRC','YYQRD','YYQRN','YYQRP','YYQRS','YYQRx'
|
|
94
|
+
,'YYQS','YYQx','YYQZ') then return('DATE');
|
|
95
|
+
else if fmt in ('TIME','B8601LZ','B8601LZ','B8601TM','B8601TM','B8601TZ'
|
|
96
|
+
,'B8601TZ','E8601LZ','E8601LZ','E8601TM','E8601TM','E8601TZ','E8601TZ'
|
|
97
|
+
,'HHMM','HOUR','MMSS','TIMEAMPM','TOD') then return('TIME');
|
|
98
|
+
else return('NUM');
|
|
99
|
+
end;
|
|
100
|
+
endsub;
|
|
101
|
+
|
|
102
|
+
%if &wrap=YES %then %do;
|
|
103
|
+
quit;
|
|
104
|
+
%end;
|
|
105
|
+
|
|
106
|
+
%if &insert_cmplib=YES %then %do;
|
|
107
|
+
options insert=(CMPLIB=(&lib..&cat));
|
|
108
|
+
%end;
|
|
109
|
+
|
|
110
|
+
%mend mcf_getfmttype;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
@file
|
|
3
|
+
@brief Sets up the mcf_xx functions
|
|
4
|
+
@details
|
|
5
|
+
There is no (efficient) way to determine if an mcf_xx macro has already been
|
|
6
|
+
invoked. So, we make use of a global macro variable list to keep track.
|
|
7
|
+
|
|
8
|
+
Usage:
|
|
9
|
+
|
|
10
|
+
%mcf_init(MCF_LENGTH)
|
|
11
|
+
|
|
12
|
+
Returns:
|
|
13
|
+
|
|
14
|
+
> 1 (if already initialised) else 0
|
|
15
|
+
|
|
16
|
+
@param [in] func The function to be initialised
|
|
17
|
+
|
|
18
|
+
<h4> Related Macros </h4>
|
|
19
|
+
@li mcf_init.test.sas
|
|
20
|
+
|
|
21
|
+
**/
|
|
22
|
+
|
|
23
|
+
%macro mcf_init(func
|
|
24
|
+
)/*/STORE SOURCE*/;
|
|
25
|
+
|
|
26
|
+
%if not (%symexist(SASJS_PREFIX)) %then %do;
|
|
27
|
+
%global SASJS_PREFIX;
|
|
28
|
+
%let SASJS_PREFIX=SASJS;
|
|
29
|
+
%end;
|
|
30
|
+
|
|
31
|
+
%let func=%upcase(&func);
|
|
32
|
+
|
|
33
|
+
/* the / character is just a seperator */
|
|
34
|
+
%global &sasjs_prefix._FUNCTIONS;
|
|
35
|
+
%if %index(&&&sasjs_prefix._FUNCTIONS,&func/)>0 %then %do;
|
|
36
|
+
1
|
|
37
|
+
%return;
|
|
38
|
+
%end;
|
|
39
|
+
%else %do;
|
|
40
|
+
%let &sasjs_prefix._FUNCTIONS=&&&sasjs_prefix._FUNCTIONS &func/;
|
|
41
|
+
0
|
|
42
|
+
%end;
|
|
43
|
+
|
|
44
|
+
%mend mcf_init;
|
package/fcmp/mcf_length.sas
CHANGED
|
@@ -39,8 +39,12 @@
|
|
|
39
39
|
@param [out] pkg= (utils) The output package in which to create the function.
|
|
40
40
|
Uses a 3 part format: libref.catalog.package
|
|
41
41
|
|
|
42
|
-
<h4>
|
|
42
|
+
<h4> SAS Macros </h4>
|
|
43
|
+
@li mcf_init.sas
|
|
44
|
+
|
|
45
|
+
<h4> Related Programs </h4>
|
|
43
46
|
@li mcf_length.test.sas
|
|
47
|
+
@li mp_init.sas
|
|
44
48
|
|
|
45
49
|
**/
|
|
46
50
|
|
|
@@ -51,13 +55,15 @@
|
|
|
51
55
|
,pkg=UTILS
|
|
52
56
|
)/*/STORE SOURCE*/;
|
|
53
57
|
|
|
58
|
+
%if %mcf_init(mcf_length)=1 %then %return;
|
|
59
|
+
|
|
54
60
|
%if &wrap=YES %then %do;
|
|
55
61
|
proc fcmp outlib=&lib..&cat..&pkg;
|
|
56
62
|
%end;
|
|
57
63
|
|
|
58
64
|
function mcf_length(var);
|
|
59
|
-
if
|
|
60
|
-
else if trunc(var,3)=var then len=3;
|
|
65
|
+
if var=. then len=0;
|
|
66
|
+
else if missing(var) or trunc(var,3)=var then len=3;
|
|
61
67
|
else if trunc(var,4)=var then len=4;
|
|
62
68
|
else if trunc(var,5)=var then len=5;
|
|
63
69
|
else if trunc(var,6)=var then len=6;
|
|
@@ -55,7 +55,11 @@
|
|
|
55
55
|
Uses a 3 part format: libref.catalog.package
|
|
56
56
|
|
|
57
57
|
<h4> SAS Macros </h4>
|
|
58
|
-
@li
|
|
58
|
+
@li mcf_init.sas
|
|
59
|
+
|
|
60
|
+
<h4> Related Programs </h4>
|
|
61
|
+
@li mcf_stpsrv_header.test.sas
|
|
62
|
+
@li mp_init.sas
|
|
59
63
|
|
|
60
64
|
**/
|
|
61
65
|
|
|
@@ -66,7 +70,7 @@
|
|
|
66
70
|
,pkg=UTILS
|
|
67
71
|
)/*/STORE SOURCE*/;
|
|
68
72
|
|
|
69
|
-
%if %
|
|
73
|
+
%if %mcf_init(stpsrv_header)=1 %then %return;
|
|
70
74
|
|
|
71
75
|
%if &wrap=YES %then %do;
|
|
72
76
|
proc fcmp outlib=&lib..&cat..&pkg;
|
package/fcmp/mcf_string2file.sas
CHANGED
|
@@ -39,6 +39,13 @@
|
|
|
39
39
|
@param [out] pkg= (utils) The output package in which to create the function.
|
|
40
40
|
Uses a 3 part format: libref.catalog.package
|
|
41
41
|
|
|
42
|
+
<h4> SAS Macros </h4>
|
|
43
|
+
@li mcf_init.sas
|
|
44
|
+
|
|
45
|
+
<h4> Related Programs </h4>
|
|
46
|
+
@li mcf_stpsrv_header.test.sas
|
|
47
|
+
@li mp_init.sas
|
|
48
|
+
|
|
42
49
|
**/
|
|
43
50
|
|
|
44
51
|
%macro mcf_string2file(wrap=NO
|
|
@@ -48,6 +55,8 @@
|
|
|
48
55
|
,pkg=UTILS
|
|
49
56
|
)/*/STORE SOURCE*/;
|
|
50
57
|
|
|
58
|
+
%if %mcf_init(mcf_string2file)=1 %then %return;
|
|
59
|
+
|
|
51
60
|
%if &wrap=YES %then %do;
|
|
52
61
|
proc fcmp outlib=&lib..&cat..&pkg;
|
|
53
62
|
%end;
|
package/meta/mm_createstp.sas
CHANGED
|
@@ -95,7 +95,6 @@ data _null_;
|
|
|
95
95
|
put ' ';
|
|
96
96
|
put '%macro mp_jsonout(action,ds,jref=_webout,dslabel=,fmt=Y ';
|
|
97
97
|
put ' ,engine=DATASTEP ';
|
|
98
|
-
put ' ,dbg=0 /* DEPRECATED */ ';
|
|
99
98
|
put ' ,missing=NULL ';
|
|
100
99
|
put ' ,showmeta=NO ';
|
|
101
100
|
put ')/*/STORE SOURCE*/; ';
|
|
@@ -165,7 +164,7 @@ data _null_;
|
|
|
165
164
|
put ' %put &sysmacroname: Switching to DATASTEP engine; ';
|
|
166
165
|
put ' %goto datastep; ';
|
|
167
166
|
put ' %end; ';
|
|
168
|
-
put ' data &tempds
|
|
167
|
+
put ' data &tempds;set &ds; ';
|
|
169
168
|
put ' %if &fmt=N %then format _numeric_ best32.;; ';
|
|
170
169
|
put ' /* PRETTY is necessary to avoid line truncation in large files */ ';
|
|
171
170
|
put ' proc json out=&jref pretty ';
|
|
@@ -191,7 +190,12 @@ data _null_;
|
|
|
191
190
|
put ' )); ';
|
|
192
191
|
put ' %do i=1 %to &numcols; ';
|
|
193
192
|
put ' length &&name&i $&&len&i; ';
|
|
194
|
-
put ' &&
|
|
193
|
+
put ' %if &&typelong&i=num %then %do; ';
|
|
194
|
+
put ' &&name&i=left(put(&&newname&i,&&fmt&i)); ';
|
|
195
|
+
put ' %end; ';
|
|
196
|
+
put ' %else %do; ';
|
|
197
|
+
put ' &&name&i=put(&&newname&i,&&fmt&i); ';
|
|
198
|
+
put ' %end; ';
|
|
195
199
|
put ' drop &&newname&i; ';
|
|
196
200
|
put ' %end; ';
|
|
197
201
|
put ' if _error_ then call symputx(''syscc'',1012); ';
|
|
@@ -211,7 +215,7 @@ data _null_;
|
|
|
211
215
|
put ' %end; ';
|
|
212
216
|
put ' other = [best.]; ';
|
|
213
217
|
put ' ';
|
|
214
|
-
put ' data &tempds
|
|
218
|
+
put ' data &tempds; ';
|
|
215
219
|
put ' attrib _all_ label=''''; ';
|
|
216
220
|
put ' %do i=1 %to &numcols; ';
|
|
217
221
|
put ' %if &&typelong&i=char or &fmt=Y %then %do; ';
|
|
@@ -273,8 +277,7 @@ data _null_;
|
|
|
273
277
|
put ' %end; ';
|
|
274
278
|
put ' ';
|
|
275
279
|
put ' proc sql; ';
|
|
276
|
-
put ' drop
|
|
277
|
-
put ' drop table &colinfo; ';
|
|
280
|
+
put ' drop table &colinfo, &tempds; ';
|
|
278
281
|
put ' ';
|
|
279
282
|
put ' %if &showmeta=YES %then %do; ';
|
|
280
283
|
put ' data _null_; file &jref encoding=''utf-8'' mod; ';
|
|
@@ -426,7 +429,7 @@ data _null_;
|
|
|
426
429
|
put ' sysvlong=quote(trim(symget(''sysvlong''))); ';
|
|
427
430
|
put ' put '',"SYSVLONG" : '' sysvlong; ';
|
|
428
431
|
put ' put ",""SYSWARNINGTEXT"" : ""&syswarningtext"" "; ';
|
|
429
|
-
put ' put '',"END_DTTM" : "'' "%sysfunc(datetime(),
|
|
432
|
+
put ' put '',"END_DTTM" : "'' "%sysfunc(datetime(),E8601DT26.6)" ''" ''; ';
|
|
430
433
|
put ' length memsize $32; ';
|
|
431
434
|
put ' memsize="%sysfunc(INPUTN(%sysfunc(getoption(memsize)), best.),sizekmg.)"; ';
|
|
432
435
|
put ' memsize=quote(cats(memsize)); ';
|
|
@@ -1,21 +1,28 @@
|
|
|
1
1
|
/**
|
|
2
2
|
@file
|
|
3
3
|
@brief Creates dataset with all members of a metadata group
|
|
4
|
-
@details
|
|
4
|
+
@details This macro will query SAS metadata and return all the members
|
|
5
|
+
of a particular group.
|
|
5
6
|
|
|
6
|
-
|
|
7
|
+
Usage:
|
|
7
8
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
%mm_getgroupmembers(someGroupName
|
|
10
|
+
,outds=work.mm_getgroupmembers
|
|
11
|
+
,emails=YES
|
|
12
|
+
)
|
|
11
13
|
|
|
12
14
|
@param group metadata group for which to bring back members
|
|
13
|
-
@param outds=
|
|
14
|
-
|
|
15
|
-
@param
|
|
15
|
+
@param outds= (work.mm_getgroupmembers) The dataset to create that contains
|
|
16
|
+
the list of members
|
|
17
|
+
@param emails= (NO) Set to YES to bring back email addresses
|
|
18
|
+
@param id= (NO) Set to yes if passing an ID rather than a group name
|
|
16
19
|
|
|
17
20
|
@returns outds dataset containing all members of the metadata group
|
|
18
21
|
|
|
22
|
+
<h4> Related Macros </h4>
|
|
23
|
+
@li mm_getgorups.sas
|
|
24
|
+
@li mm_adduser2group.sas
|
|
25
|
+
|
|
19
26
|
@version 9.2
|
|
20
27
|
@author Allan Bowe
|
|
21
28
|
|
|
@@ -41,7 +41,11 @@ run;
|
|
|
41
41
|
|
|
42
42
|
filename __mc1 temp;
|
|
43
43
|
filename __mc2 temp;
|
|
44
|
-
data &outds;
|
|
44
|
+
data &outds;
|
|
45
|
+
length serveruri servername $200;
|
|
46
|
+
call missing (of _all_);
|
|
47
|
+
stop;
|
|
48
|
+
run;
|
|
45
49
|
%do x=1 %to &repocnt;
|
|
46
50
|
options metarepository=&&repo&x;
|
|
47
51
|
proc metadata in=
|
|
@@ -60,13 +64,16 @@ data &outds; length serveruri servername $200; stop;run;
|
|
|
60
64
|
data _null_;
|
|
61
65
|
file __mc2;
|
|
62
66
|
put '<SXLEMAP version="1.2" name="SASContexts"><TABLE name="SASContexts">';
|
|
63
|
-
put "<TABLE-PATH syntax='XPath'>/GetMetadataObjects/Objects/ServerContext
|
|
67
|
+
put "<TABLE-PATH syntax='XPath'>/GetMetadataObjects/Objects/ServerContext";
|
|
68
|
+
put "</TABLE-PATH>";
|
|
64
69
|
put '<COLUMN name="serveruri">';
|
|
65
|
-
put "<PATH syntax='XPath'>/GetMetadataObjects/Objects/ServerContext/@Id
|
|
70
|
+
put "<PATH syntax='XPath'>/GetMetadataObjects/Objects/ServerContext/@Id";
|
|
71
|
+
put "</PATH>";
|
|
66
72
|
put "<TYPE>character</TYPE><DATATYPE>string</DATATYPE><LENGTH>200</LENGTH>";
|
|
67
73
|
put '</COLUMN>';
|
|
68
74
|
put '<COLUMN name="servername">';
|
|
69
|
-
put "<PATH syntax='XPath'>/GetMetadataObjects/Objects/ServerContext/@Name
|
|
75
|
+
put "<PATH syntax='XPath'>/GetMetadataObjects/Objects/ServerContext/@Name";
|
|
76
|
+
put "</PATH>";
|
|
70
77
|
put "<TYPE>character</TYPE><DATATYPE>string</DATATYPE><LENGTH>200</LENGTH>";
|
|
71
78
|
put '</COLUMN>';
|
|
72
79
|
put '</TABLE></SXLEMAP>';
|
|
@@ -13,9 +13,6 @@
|
|
|
13
13
|
@param [in] stpcode= the source file (or fileref) containing the SAS code to load
|
|
14
14
|
into the stp. For multiple files, they should simply be concatenated first.
|
|
15
15
|
@param [in] minify= set to YES in order to strip comments, blank lines, and CRLFs.
|
|
16
|
-
|
|
17
|
-
@param frefin= deprecated - a unique fileref is now always used
|
|
18
|
-
@param frefout= deprecated - a unique fileref is now always used
|
|
19
16
|
@param mDebug= set to 1 to show debug messages in the log
|
|
20
17
|
|
|
21
18
|
@version 9.3
|
|
@@ -30,16 +27,8 @@
|
|
|
30
27
|
,stpcode=
|
|
31
28
|
,minify=NO
|
|
32
29
|
,mdebug=0
|
|
33
|
-
/* deprecated */
|
|
34
|
-
,frefin=inmeta
|
|
35
|
-
,frefout=outmeta
|
|
36
30
|
);
|
|
37
31
|
|
|
38
|
-
%if &frefin ne inmeta or &frefout ne outmeta %then %do;
|
|
39
|
-
%put %str(WARN)ING: the frefin and frefout parameters will be deprecated in
|
|
40
|
-
an upcoming release.;
|
|
41
|
-
%end;
|
|
42
|
-
|
|
43
32
|
/* first, check if STP exists */
|
|
44
33
|
%local tsuri;
|
|
45
34
|
%let tsuri=stopifempty ;
|
package/meta/mm_webout.sas
CHANGED
|
@@ -165,7 +165,7 @@
|
|
|
165
165
|
sysvlong=quote(trim(symget('sysvlong')));
|
|
166
166
|
put ',"SYSVLONG" : ' sysvlong;
|
|
167
167
|
put ",""SYSWARNINGTEXT"" : ""&syswarningtext"" ";
|
|
168
|
-
put ',"END_DTTM" : "' "%sysfunc(datetime(),
|
|
168
|
+
put ',"END_DTTM" : "' "%sysfunc(datetime(),E8601DT26.6)" '" ';
|
|
169
169
|
length memsize $32;
|
|
170
170
|
memsize="%sysfunc(INPUTN(%sysfunc(getoption(memsize)), best.),sizekmg.)";
|
|
171
171
|
memsize=quote(cats(memsize));
|
package/package.json
CHANGED
package/server/ms_webout.sas
CHANGED
|
@@ -161,7 +161,7 @@
|
|
|
161
161
|
sysvlong=quote(trim(symget('sysvlong')));
|
|
162
162
|
put ',"SYSVLONG" : ' sysvlong;
|
|
163
163
|
put ",""SYSWARNINGTEXT"" : ""&syswarningtext"" ";
|
|
164
|
-
put ',"END_DTTM" : "' "%sysfunc(datetime(),
|
|
164
|
+
put ',"END_DTTM" : "' "%sysfunc(datetime(),E8601DT26.6)" '" ';
|
|
165
165
|
length autoexec $512;
|
|
166
166
|
autoexec=quote(urlencode(trim(getoption('autoexec'))));
|
|
167
167
|
put ',"AUTOEXEC" : ' autoexec;
|
|
@@ -239,7 +239,6 @@ data _null_;
|
|
|
239
239
|
put ' ';
|
|
240
240
|
put '%macro mp_jsonout(action,ds,jref=_webout,dslabel=,fmt=Y ';
|
|
241
241
|
put ' ,engine=DATASTEP ';
|
|
242
|
-
put ' ,dbg=0 /* DEPRECATED */ ';
|
|
243
242
|
put ' ,missing=NULL ';
|
|
244
243
|
put ' ,showmeta=NO ';
|
|
245
244
|
put ')/*/STORE SOURCE*/; ';
|
|
@@ -309,7 +308,7 @@ data _null_;
|
|
|
309
308
|
put ' %put &sysmacroname: Switching to DATASTEP engine; ';
|
|
310
309
|
put ' %goto datastep; ';
|
|
311
310
|
put ' %end; ';
|
|
312
|
-
put ' data &tempds
|
|
311
|
+
put ' data &tempds;set &ds; ';
|
|
313
312
|
put ' %if &fmt=N %then format _numeric_ best32.;; ';
|
|
314
313
|
put ' /* PRETTY is necessary to avoid line truncation in large files */ ';
|
|
315
314
|
put ' proc json out=&jref pretty ';
|
|
@@ -335,7 +334,12 @@ data _null_;
|
|
|
335
334
|
put ' )); ';
|
|
336
335
|
put ' %do i=1 %to &numcols; ';
|
|
337
336
|
put ' length &&name&i $&&len&i; ';
|
|
338
|
-
put ' &&
|
|
337
|
+
put ' %if &&typelong&i=num %then %do; ';
|
|
338
|
+
put ' &&name&i=left(put(&&newname&i,&&fmt&i)); ';
|
|
339
|
+
put ' %end; ';
|
|
340
|
+
put ' %else %do; ';
|
|
341
|
+
put ' &&name&i=put(&&newname&i,&&fmt&i); ';
|
|
342
|
+
put ' %end; ';
|
|
339
343
|
put ' drop &&newname&i; ';
|
|
340
344
|
put ' %end; ';
|
|
341
345
|
put ' if _error_ then call symputx(''syscc'',1012); ';
|
|
@@ -355,7 +359,7 @@ data _null_;
|
|
|
355
359
|
put ' %end; ';
|
|
356
360
|
put ' other = [best.]; ';
|
|
357
361
|
put ' ';
|
|
358
|
-
put ' data &tempds
|
|
362
|
+
put ' data &tempds; ';
|
|
359
363
|
put ' attrib _all_ label=''''; ';
|
|
360
364
|
put ' %do i=1 %to &numcols; ';
|
|
361
365
|
put ' %if &&typelong&i=char or &fmt=Y %then %do; ';
|
|
@@ -417,8 +421,7 @@ data _null_;
|
|
|
417
421
|
put ' %end; ';
|
|
418
422
|
put ' ';
|
|
419
423
|
put ' proc sql; ';
|
|
420
|
-
put ' drop
|
|
421
|
-
put ' drop table &colinfo; ';
|
|
424
|
+
put ' drop table &colinfo, &tempds; ';
|
|
422
425
|
put ' ';
|
|
423
426
|
put ' %if &showmeta=YES %then %do; ';
|
|
424
427
|
put ' data _null_; file &jref encoding=''utf-8'' mod; ';
|
|
@@ -627,7 +630,7 @@ data _null_;
|
|
|
627
630
|
put ' sysvlong=quote(trim(symget(''sysvlong''))); ';
|
|
628
631
|
put ' put '',"SYSVLONG" : '' sysvlong; ';
|
|
629
632
|
put ' put ",""SYSWARNINGTEXT"" : ""&syswarningtext"" "; ';
|
|
630
|
-
put ' put '',"END_DTTM" : "'' "%sysfunc(datetime(),
|
|
633
|
+
put ' put '',"END_DTTM" : "'' "%sysfunc(datetime(),E8601DT26.6)" ''" ''; ';
|
|
631
634
|
put ' length memsize $32; ';
|
|
632
635
|
put ' memsize="%sysfunc(INPUTN(%sysfunc(getoption(memsize)), best.),sizekmg.)"; ';
|
|
633
636
|
put ' memsize=quote(cats(memsize)); ';
|
|
@@ -117,6 +117,7 @@ libname &libref1a JSON fileref=&fname1a;
|
|
|
117
117
|
%let found=0;
|
|
118
118
|
%put Getting object uri from &libref1a..items;
|
|
119
119
|
data _null_;
|
|
120
|
+
length contenttype name $1000;
|
|
120
121
|
set &libref1a..items;
|
|
121
122
|
if contenttype="&contenttype" and upcase(name)="%upcase(&name)" then do;
|
|
122
123
|
call symputx('uri',uri,'l');
|
package/viya/mv_deletejes.sas
CHANGED
|
@@ -114,6 +114,7 @@ libname &libref1a JSON fileref=&fname1a;
|
|
|
114
114
|
%let found=0;
|
|
115
115
|
%put Getting object uri from &libref1a..items;
|
|
116
116
|
data _null_;
|
|
117
|
+
length contenttype name $1000;
|
|
117
118
|
set &libref1a..items;
|
|
118
119
|
if contenttype='jobDefinition' and upcase(name)="%upcase(&name)" then do;
|
|
119
120
|
call symputx('uri',cats("&base_uri",uri),'l');
|
package/viya/mv_webout.sas
CHANGED
|
@@ -225,7 +225,7 @@
|
|
|
225
225
|
sysvlong=quote(trim(symget('sysvlong')));
|
|
226
226
|
put ',"SYSVLONG" : ' sysvlong;
|
|
227
227
|
put ",""SYSWARNINGTEXT"" : ""&syswarningtext"" ";
|
|
228
|
-
put ',"END_DTTM" : "' "%sysfunc(datetime(),
|
|
228
|
+
put ',"END_DTTM" : "' "%sysfunc(datetime(),E8601DT26.6)" '" ';
|
|
229
229
|
length memsize $32;
|
|
230
230
|
memsize="%sysfunc(INPUTN(%sysfunc(getoption(memsize)), best.),sizekmg.)";
|
|
231
231
|
memsize=quote(cats(memsize));
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
@file mv_getaccesstoken.sas
|
|
3
|
-
@brief deprecated - replaced by mv_tokenrefresh.sas
|
|
4
|
-
|
|
5
|
-
@version VIYA V.03.04
|
|
6
|
-
@author Allan Bowe, source: https://github.com/sasjs/core
|
|
7
|
-
|
|
8
|
-
<h4> SAS Macros </h4>
|
|
9
|
-
@li mv_tokenrefresh.sas
|
|
10
|
-
|
|
11
|
-
**/
|
|
12
|
-
|
|
13
|
-
%macro mv_getaccesstoken(client_id=someclient
|
|
14
|
-
,client_secret=somesecret
|
|
15
|
-
,grant_type=authorization_code
|
|
16
|
-
,code=
|
|
17
|
-
,user=
|
|
18
|
-
,pass=
|
|
19
|
-
,access_token_var=ACCESS_TOKEN
|
|
20
|
-
,refresh_token_var=REFRESH_TOKEN
|
|
21
|
-
);
|
|
22
|
-
|
|
23
|
-
%mv_tokenrefresh(client_id=&client_id
|
|
24
|
-
,client_secret=&client_secret
|
|
25
|
-
,grant_type=&grant_type
|
|
26
|
-
,user=&user
|
|
27
|
-
,pass=&pass
|
|
28
|
-
,access_token_var=&access_token_var
|
|
29
|
-
,refresh_token_var=&refresh_token_var
|
|
30
|
-
)
|
|
31
|
-
|
|
32
|
-
%mend mv_getaccesstoken;
|
package/viya/mv_getapptoken.sas
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
@file
|
|
3
|
-
@brief deprecated - replaced by mv_registerclient.sas
|
|
4
|
-
|
|
5
|
-
@version VIYA V.03.04
|
|
6
|
-
@author Allan Bowe, source: https://github.com/sasjs/core
|
|
7
|
-
|
|
8
|
-
<h4> SAS Macros </h4>
|
|
9
|
-
@li mv_registerclient.sas
|
|
10
|
-
|
|
11
|
-
**/
|
|
12
|
-
|
|
13
|
-
%macro mv_getapptoken(client_id=someclient
|
|
14
|
-
,client_secret=somesecret
|
|
15
|
-
,grant_type=authorization_code
|
|
16
|
-
);
|
|
17
|
-
|
|
18
|
-
%mv_registerclient(client_id=&client_id
|
|
19
|
-
,client_secret=&client_secret
|
|
20
|
-
,grant_type=&grant_type
|
|
21
|
-
)
|
|
22
|
-
|
|
23
|
-
%mend mv_getapptoken;
|