@sasjs/core 4.4.2 → 4.4.6
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 +4 -5
- package/base/mf_getapploc.sas +7 -2
- package/base/mf_verifymacvars.sas +13 -6
- package/base/mp_streamfile.sas +11 -1
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -81,7 +81,7 @@ Macros used for interfacing with SAS Viya.
|
|
|
81
81
|
|
|
82
82
|
Wait - this is a macro library - what is LUA doing here? Well, it is a little known fact that you CAN run LUA within a SAS Macro. It has to be written to a text file with a `.lua` extension, from where you can `%include` it. So, without using the `proc lua` wrapper.
|
|
83
83
|
|
|
84
|
-
To contribute, simply write your freeform LUA in the LUA folder. Then run the `build.py`, which will convert
|
|
84
|
+
To contribute, simply write your freeform LUA in the LUA folder. Then run the `build.py`, which will convert all files with a ".lua" extension into a macro wrapper with an `ml_` prefix (embedding the necessary data step put statements). You can then use your module in any program by running:
|
|
85
85
|
|
|
86
86
|
```sas
|
|
87
87
|
/* compile the lua module */
|
|
@@ -95,8 +95,7 @@ endsubmit;
|
|
|
95
95
|
run;
|
|
96
96
|
```
|
|
97
97
|
|
|
98
|
-
-
|
|
99
|
-
- Prefixes: _mmw_,_mmu_,_mmx_
|
|
98
|
+
- Prefixes: _ml_
|
|
100
99
|
|
|
101
100
|
## Installation
|
|
102
101
|
|
|
@@ -129,11 +128,11 @@ filename mc url "https://raw.githubusercontent.com/sasjs/core/main/all.sas";
|
|
|
129
128
|
- _mf_ for macro functions (can be used in open code).
|
|
130
129
|
- _ml_ for macros that are used to compile LUA modules
|
|
131
130
|
- _mm_ for metadata macros (interface with the metadata server).
|
|
132
|
-
- _mmx_ for macros that use metadata and are XCMD enabled
|
|
131
|
+
- _mmx_ for macros that use metadata and are XCMD enabled (working on both windows and unix)
|
|
133
132
|
- _mp_ for macro procedures (which generate sas code)
|
|
134
133
|
- _ms_ for macro procedures that will only work with [@sasjs/server](https://github.com/sasjs/server)
|
|
135
134
|
- _mv_ for macro procedures that will only work in Viya
|
|
136
|
-
- _mx_ for macros that are XCMD enabled
|
|
135
|
+
- _mx_ for macros that are XCMD enabled (working on both windows and unix)
|
|
137
136
|
- follow verb-noun convention
|
|
138
137
|
- unix style line endings (lf)
|
|
139
138
|
- individual lines should be no more than 80 characters long
|
package/base/mf_getapploc.sas
CHANGED
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
@li /data
|
|
16
16
|
@li /jobs
|
|
17
17
|
@li /services
|
|
18
|
+
@li /tests
|
|
18
19
|
@li /tests/jobs
|
|
19
20
|
@li /tests/services
|
|
20
21
|
@li /tests/macros
|
|
@@ -46,9 +47,13 @@
|
|
|
46
47
|
|
|
47
48
|
/**
|
|
48
49
|
* First check we are not in the tests/macros folder (which has no subfolders)
|
|
50
|
+
* or specifically in the testsetup or testteardown services
|
|
49
51
|
*/
|
|
50
|
-
%if %index(&pgm,/tests/macros/)
|
|
51
|
-
|
|
52
|
+
%if %index(&pgm,/tests/macros/)
|
|
53
|
+
or %index(&pgm,/tests/testsetup)
|
|
54
|
+
or %index(&pgm,/tests/testteardown)
|
|
55
|
+
%then %do;
|
|
56
|
+
%let root=%substr(&pgm,1,%index(&pgm,/tests)-1);
|
|
52
57
|
&root
|
|
53
58
|
%return;
|
|
54
59
|
%end;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
@file
|
|
3
|
-
@brief Checks if a set of macro variables exist
|
|
3
|
+
@brief Checks if a set of macro variables exist AND contain values.
|
|
4
4
|
@details Writes ERROR to log if abortType is SOFT, else will call %mf_abort.
|
|
5
5
|
Usage:
|
|
6
6
|
|
|
@@ -14,10 +14,11 @@
|
|
|
14
14
|
<h4> SAS Macros </h4>
|
|
15
15
|
@li mf_abort.sas
|
|
16
16
|
|
|
17
|
-
@param verifyvars
|
|
18
|
-
@param makeupcase=
|
|
17
|
+
@param [in] verifyvars Space separated list of macro variable names
|
|
18
|
+
@param [in] makeupcase= (NO) Set to YES to convert all variable VALUES to
|
|
19
19
|
uppercase.
|
|
20
|
-
@param mAbort= Abort Type.
|
|
20
|
+
@param [in] mAbort= (SOFT) Abort Type. When SOFT, simply writes an err
|
|
21
|
+
message to the log.
|
|
21
22
|
Set to any other value to call mf_abort (which can be configured to abort in
|
|
22
23
|
various fashions according to context).
|
|
23
24
|
|
|
@@ -58,8 +59,14 @@
|
|
|
58
59
|
|
|
59
60
|
%goto exit_success;
|
|
60
61
|
%exit_err:
|
|
61
|
-
%
|
|
62
|
-
%
|
|
62
|
+
%put %str(ERR)OR: &abortmsg;
|
|
63
|
+
%mf_abort(iftrue=(&mabort ne SOFT),
|
|
64
|
+
mac=mf_verifymacvars,
|
|
65
|
+
msg=%str(&abortmsg)
|
|
66
|
+
)
|
|
67
|
+
0
|
|
68
|
+
%return;
|
|
63
69
|
%exit_success:
|
|
70
|
+
1
|
|
64
71
|
|
|
65
72
|
%mend mf_verifymacvars;
|
package/base/mp_streamfile.sas
CHANGED
|
@@ -81,6 +81,17 @@ run;
|
|
|
81
81
|
contentdisp="attachment; filename=&outname";
|
|
82
82
|
%end;
|
|
83
83
|
%end;
|
|
84
|
+
%else %if &contentype=GIF or &contentype=JPEG or &contentype=PNG %then %do;
|
|
85
|
+
%if &platform=SASMETA and &streamweb=1 %then %do;
|
|
86
|
+
data _null_;
|
|
87
|
+
rc=stpsrv_header('Content-type',"image/%lowcase(&contenttype)");
|
|
88
|
+
run;
|
|
89
|
+
%end;
|
|
90
|
+
%else %if &platform=SASVIYA %then %do;
|
|
91
|
+
filename &outref filesrvc parenturi="&SYS_JES_JOB_URI"
|
|
92
|
+
contenttype="image/%lowcase(&contenttype)";
|
|
93
|
+
%end;
|
|
94
|
+
%end;
|
|
84
95
|
%else %if &contentype=HTML %then %do;
|
|
85
96
|
%if &platform=SASVIYA %then %do;
|
|
86
97
|
filename &outref filesrvc parenturi="&SYS_JES_JOB_URI" name="_webout.json"
|
|
@@ -141,7 +152,6 @@ run;
|
|
|
141
152
|
%end;
|
|
142
153
|
%else %do;
|
|
143
154
|
%put %str(ERR)OR: Content Type &contenttype NOT SUPPORTED by &sysmacroname!;
|
|
144
|
-
%return;
|
|
145
155
|
%end;
|
|
146
156
|
|
|
147
157
|
%if &inref ne 0 %then %do;
|
package/package.json
CHANGED