@sasjs/core 4.9.1 → 4.9.4

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.
@@ -12,13 +12,14 @@
12
12
  The macro is idempotent - if you run it twice, it will only create a folder
13
13
  once.
14
14
 
15
- usage:
15
+ Usage:
16
16
 
17
17
  %mm_createfolder(path=/some/meta/folder)
18
18
 
19
19
  @param [in] path= Name of the folder to create.
20
20
  @param [in] mdebug= set DBG to 1 to disable DEBUG messages
21
21
 
22
+
22
23
  @version 9.4
23
24
  @author Allan Bowe
24
25
 
@@ -12,7 +12,7 @@
12
12
  This macro is idempotent - if you run it twice, it will only create an STP
13
13
  once.
14
14
 
15
- usage (type 1 STP):
15
+ Usage (type 1 STP):
16
16
 
17
17
  %mm_createstp(stpname=MyNewSTP
18
18
  ,filename=mySpecialProgram.sas
@@ -31,7 +31,8 @@
31
31
  putlog (_all_)(=);
32
32
  run;
33
33
 
34
- usage (type 2 STP):
34
+ Usage (type 2 STP):
35
+
35
36
  %mm_createstp(stpname=MyNewType2STP
36
37
  ,filename=mySpecialProgram.sas
37
38
  ,directory=SASEnvironment/SASCode/STPs
@@ -74,8 +75,9 @@
74
75
  @li mf_verifymacvars.sas
75
76
  @li mm_getdirectories.sas
76
77
  @li mm_updatestpsourcecode.sas
77
- @li mp_dropmembers.sas
78
78
  @li mm_getservercontexts.sas
79
+ @li mp_abort.sas
80
+ @li mp_dropmembers.sas
79
81
 
80
82
  <h4> Related Macros </h4>
81
83
  @li mm_createwebservice.sas
@@ -1,16 +1,21 @@
1
1
  /**
2
2
  @file mm_getauthinfo.sas
3
- @brief extracts authentication info
4
- @details usage:
3
+ @brief Extracts authentication info for each user in metadata
4
+ @details
5
+ Usage:
5
6
 
6
- %mm_getauthinfo(outds=auths)
7
+ %mm_getauthinfo(outds=auths)
7
8
 
8
- @param outds= the ONE LEVEL work dataset to create
9
+
10
+ @param [in] mdebug= (0) Set to 1 to enable DEBUG messages and preserve outputs
11
+ @param [out] outds= (mm_getauthinfo) The output dataset to create
9
12
 
10
13
  <h4> SAS Macros </h4>
11
- @li mm_getobjects.sas
12
14
  @li mf_getuniquefileref.sas
15
+ @li mf_getuniquename.sas
13
16
  @li mm_getdetails.sas
17
+ @li mm_getobjects.sas
18
+
14
19
 
15
20
  @version 9.4
16
21
  @author Allan Bowe
@@ -18,67 +23,69 @@
18
23
  **/
19
24
 
20
25
  %macro mm_getauthinfo(outds=mm_getauthinfo
26
+ ,mdebug=0
21
27
  )/*/STORE SOURCE*/;
28
+ %local prefix fileref;
29
+ %let prefix=%substr(%mf_getuniquename(),1,25);
22
30
 
23
- %if %length(&outds)>30 %then %do;
24
- %put %str(ERR)OR: Temp tables are created with the &outds prefix, which
25
- therefore needs to be 30 characters or less;
26
- %return;
27
- %end;
28
- %if %index(&outds,'.')>0 %then %do;
29
- %put %str(ERR)OR: Table &outds should be ONE LEVEL (no library);
30
- %return;
31
- %end;
32
-
33
- %mm_getobjects(type=Login,outds=&outds.0)
31
+ %mm_getobjects(type=Login,outds=&prefix.0)
34
32
 
35
33
  %local fileref;
36
34
  %let fileref=%mf_getuniquefileref();
37
35
 
38
36
  data _null_;
39
37
  file &fileref;
40
- set &outds.0 end=last;
38
+ set &prefix.0 end=last;
41
39
  /* run macro */
42
- str=cats('%mm_getdetails(uri=',id,",outattrs=&outds.d",_n_
43
- ,",outassocs=&outds.a",_n_,")");
40
+ str=cats('%mm_getdetails(uri=',id,",outattrs=&prefix.d",_n_
41
+ ,",outassocs=&prefix.a",_n_,")");
44
42
  put str;
45
43
  /* transpose attributes */
46
- str=cats("proc transpose data=&outds.d",_n_,"(drop=type) out=&outds.da"
44
+ str=cats("proc transpose data=&prefix.d",_n_,"(drop=type) out=&prefix.da"
47
45
  ,_n_,"(drop=_name_);var value;id name;run;");
48
46
  put str;
49
47
  /* add extra info to attributes */
50
- str=cats("data &outds.da",_n_,";length login_id login_name $256; login_id="
51
- ,quote(trim(id)),";set &outds.da",_n_
48
+ str=cats("data &prefix.da",_n_,";length login_id login_name $256; login_id="
49
+ ,quote(trim(id)),";set &prefix.da",_n_
52
50
  ,";login_name=trim(subpad(name,1,256));drop name;run;");
53
51
  put str;
54
52
  /* add extra info to associations */
55
- str=cats("data &outds.a",_n_,";length login_id login_name $256; login_id="
53
+ str=cats("data &prefix.a",_n_,";length login_id login_name $256; login_id="
56
54
  ,quote(trim(id)),";login_name=",quote(trim(name))
57
- ,";set &outds.a",_n_,";run;");
55
+ ,";set &prefix.a",_n_,";run;");
58
56
  put str;
59
57
  if last then do;
60
58
  /* collate attributes */
61
- str=cats("data &outds._logat; set &outds.da1-&outds.da",_n_,";run;");
59
+ str=cats("data &prefix._logat; set &prefix.da1-&prefix.da",_n_,";run;");
62
60
  put str;
63
61
  /* collate associations */
64
- str=cats("data &outds._logas; set &outds.a1-&outds.a",_n_,";run;");
62
+ str=cats("data &prefix._logas; set &prefix.a1-&prefix.a",_n_,";run;");
65
63
  put str;
66
64
  /* tidy up */
67
- str=cats("proc delete data=&outds.da1-&outds.da",_n_,";run;");
65
+ str=cats("proc delete data=&prefix.da1-&prefix.da",_n_,";run;");
68
66
  put str;
69
- str=cats("proc delete data=&outds.d1-&outds.d",_n_,";run;");
67
+ str=cats("proc delete data=&prefix.d1-&prefix.d",_n_,";run;");
70
68
  put str;
71
- str=cats("proc delete data=&outds.a1-&outds.a",_n_,";run;");
69
+ str=cats("proc delete data=&prefix.a1-&prefix.a",_n_,";run;");
72
70
  put str;
73
71
  end;
74
72
  run;
73
+
74
+ %if &mdebug=1 %then %do;
75
+ data _null_;
76
+ infile &fileref;
77
+ if _n_=1 then putlog // "Now executing the following code:" //;
78
+ input; putlog _infile_;
79
+ run;
80
+ %end;
75
81
  %inc &fileref;
82
+ filename &fileref clear;
76
83
 
77
84
  /* get libraries */
78
- proc sort data=&outds._logas(where=(assoc='Libraries')) out=&outds._temp;
85
+ proc sort data=&prefix._logas(where=(assoc='Libraries')) out=&prefix._temp;
79
86
  by login_id;
80
- data &outds._temp;
81
- set &outds._temp;
87
+ data &prefix._temp;
88
+ set &prefix._temp;
82
89
  by login_id;
83
90
  length library_list $32767;
84
91
  retain library_list;
@@ -86,31 +93,27 @@ data &outds._temp;
86
93
  else library_list=catx(' !! ',library_list,name);
87
94
  proc sql;
88
95
  /* get auth domain */
89
- create table &outds._dom as
96
+ create table &prefix._dom as
90
97
  select login_id,name as domain
91
- from &outds._logas
98
+ from &prefix._logas
92
99
  where assoc='Domain';
93
- create unique index login_id on &outds._dom(login_id);
100
+ create unique index login_id on &prefix._dom(login_id);
94
101
  /* join it all together */
95
- create table &outds._logins as
102
+ create table &outds as
96
103
  select a.*
97
104
  ,c.domain
98
105
  ,b.library_list
99
- from &outds._logat (drop=ishidden lockedby usageversion publictype) a
100
- left join &outds._temp b
106
+ from &prefix._logat (drop=ishidden lockedby usageversion publictype) a
107
+ left join &prefix._temp b
101
108
  on a.login_id=b.login_id
102
- left join &outds._dom c
109
+ left join &prefix._dom c
103
110
  on a.login_id=c.login_id;
104
- drop table &outds._temp;
105
- drop table &outds._logat;
106
- drop table &outds._logas;
107
111
 
108
- data _null_;
109
- infile &fileref;
110
- if _n_=1 then putlog // "Now executing the following code:" //;
111
- input; putlog _infile_;
112
- run;
112
+ %if &mdebug=0 %then %do;
113
+ proc datasets lib=work;
114
+ delete &prefix:;
115
+ run;
116
+ %end;
113
117
 
114
- filename &fileref clear;
115
118
 
116
119
  %mend mm_getauthinfo;
package/package.json CHANGED
@@ -36,5 +36,5 @@
36
36
  "@sasjs/cli": "3.6.0",
37
37
  "@sasjs/core": "4.4.7"
38
38
  },
39
- "version": "4.9.1"
39
+ "version": "4.9.4"
40
40
  }
@@ -33,8 +33,9 @@
33
33
  `,"$tablename":{"formats":{"col1":"$CHAR1"},"types":{"COL1":"C"}}`
34
34
 
35
35
  <h4> SAS Macros </h4>
36
- @li mp_jsonout.sas
37
36
  @li mf_getuser.sas
37
+ @li mp_jsonout.sas
38
+ @li mfs_httpheader.sas
38
39
 
39
40
  <h4> Related Macros </h4>
40
41
  @li mv_webout.sas
@@ -86,6 +87,9 @@
86
87
  /* fix encoding */
87
88
  OPTIONS NOBOMFILE;
88
89
 
90
+ /* set the header */
91
+ %mfs_httpheader(Content-type,application/json)
92
+
89
93
  /* setup json */
90
94
  data _null_;file &fref encoding='utf-8' termstr=lf;
91
95
  put '{"SYSDATE" : "' "&SYSDATE" '"';