@sasjs/core 7.1.7 → 7.1.9
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 +20 -19
- package/base/mf_abort.sas +5 -0
- package/base/mf_getxengine.sas +3 -1
- package/base/mf_loc.sas +4 -4
- package/base/mp_guesspk.sas +1 -1
- package/base/mp_include.sas +0 -2
- package/base/mp_replace.sas +13 -4
- package/base/mp_stprequests.sas +15 -8
- package/base/mp_testwritespeedlibrary.sas +8 -3
- package/base/mp_updatevarlength.sas +2 -2
- package/base/mp_wait4file.sas +3 -2
- package/package.json +1 -1
- package/viya/mv_getjobresult.sas +55 -1
- package/viya/mv_registerclient.sas +2 -2
- package/base/mp_runddl.sas +0 -49
package/README.md
CHANGED
|
@@ -167,7 +167,7 @@ The **Macro Core** documentation is created using [doxygen](http://www.doxygen.n
|
|
|
167
167
|
|
|
168
168
|
- file. This needs to be present in order to be recognised by doxygen.
|
|
169
169
|
- brief. This is a short (one sentence) description of the macro.
|
|
170
|
-
- details. A longer description, which can contain doxygen [markdown](
|
|
170
|
+
- details. A longer description, which can contain doxygen [markdown](https://www.doxygen.nl/manual/markdown.html).
|
|
171
171
|
- param. Name of each input param followed by a description.
|
|
172
172
|
- return. Explanation of what is returned by the macro.
|
|
173
173
|
- version. The EARLIEST SAS version in which this macro is known to work.
|
|
@@ -252,9 +252,9 @@ The following repositories are also worth checking out:
|
|
|
252
252
|
|
|
253
253
|
## Contributors ✨
|
|
254
254
|
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
|
|
255
|
-
[](#contributors-)
|
|
256
256
|
<!-- ALL-CONTRIBUTORS-BADGE:END -->
|
|
257
|
-
Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/
|
|
257
|
+
Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/en/reference/emoji-key/)):
|
|
258
258
|
|
|
259
259
|
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
|
|
260
260
|
<!-- prettier-ignore-start -->
|
|
@@ -262,26 +262,27 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
|
|
|
262
262
|
<table>
|
|
263
263
|
<tbody>
|
|
264
264
|
<tr>
|
|
265
|
-
<td align="center" valign="top" width="14.28%"><a href="https://github.com/allanbowe"><img src="https://avatars.githubusercontent.com/u/4420615?v=4
|
|
266
|
-
<td align="center" valign="top" width="14.28%"><a href="https://github.com/rafgag"><img src="https://avatars.githubusercontent.com/u/69139928?v=4
|
|
267
|
-
<td align="center" valign="top" width="14.28%"><a href="https://github.com/tmoody"><img src="https://avatars.githubusercontent.com/u/79837106?v=4
|
|
268
|
-
<td align="center" valign="top" width="14.28%"><a href="https://krishna-acondy.io/"><img src="https://avatars.githubusercontent.com/u/2980428?v=4
|
|
269
|
-
<td align="center" valign="top" width="14.28%"><a href="https://github.com/saadjutt01"><img src="https://avatars.githubusercontent.com/u/8914650?v=4
|
|
270
|
-
<td align="center" valign="top" width="14.28%"><a href="https://www.erudicat.com/"><img src="https://avatars.githubusercontent.com/u/25773492?v=4
|
|
271
|
-
<td align="center" valign="top" width="14.28%"><a href="https://github.com/medjedovicm"><img src="https://avatars.githubusercontent.com/u/18329105?v=4
|
|
265
|
+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/allanbowe"><img src="https://avatars.githubusercontent.com/u/4420615?v=4&size=100" width="100px" height="100px" alt="Allan Bowe"/><br /><sub><b>Allan Bowe</b></sub></a><br /><a href="#business-allanbowe" title="Business development">💼</a> <a href="https://github.com/sasjs/core/commits?author=allanbowe" title="Code">💻</a> <a href="#content-allanbowe" title="Content">🖋</a> <a href="https://github.com/sasjs/core/commits?author=allanbowe" title="Documentation">📖</a> <a href="#infra-allanbowe" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a> <a href="#maintenance-allanbowe" title="Maintenance">🚧</a> <a href="#mentoring-allanbowe" title="Mentoring">🧑🏫</a> <a href="#question-allanbowe" title="Answering Questions">💬</a> <a href="https://github.com/sasjs/core/pulls?q=is%3Apr+reviewed-by%3Aallanbowe" title="Reviewed Pull Requests">👀</a> <a href="https://github.com/sasjs/core/commits?author=allanbowe" title="Tests">⚠️</a></td>
|
|
266
|
+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/rafgag"><img src="https://avatars.githubusercontent.com/u/69139928?v=4&size=100" width="100px" height="100px" alt="rafgag"/><br /><sub><b>rafgag</b></sub></a><br /><a href="https://github.com/sasjs/core/commits?author=rafgag" title="Code">💻</a></td>
|
|
267
|
+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/tmoody"><img src="https://avatars.githubusercontent.com/u/79837106?v=4&size=100" width="100px" height="100px" alt="Trevor Moody"/><br /><sub><b>Trevor Moody</b></sub></a><br /><a href="https://github.com/sasjs/core/commits?author=tmoody" title="Code">💻</a></td>
|
|
268
|
+
<td align="center" valign="top" width="14.28%"><a href="https://krishna-acondy.io/"><img src="https://avatars.githubusercontent.com/u/2980428?v=4&size=100" width="100px" height="100px" alt="Krishna Acondy"/><br /><sub><b>Krishna Acondy</b></sub></a><br /><a href="https://github.com/sasjs/core/commits?author=krishna-acondy" title="Code">💻</a> <a href="#infra-krishna-acondy" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a> <a href="#blog-krishna-acondy" title="Blogposts">📝</a> <a href="#content-krishna-acondy" title="Content">🖋</a> <a href="#ideas-krishna-acondy" title="Ideas, Planning, & Feedback">🤔</a> <a href="#video-krishna-acondy" title="Videos">📹</a></td>
|
|
269
|
+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/saadjutt01"><img src="https://avatars.githubusercontent.com/u/8914650?v=4&size=100" width="100px" height="100px" alt="Muhammad Saad "/><br /><sub><b>Muhammad Saad </b></sub></a><br /><a href="https://github.com/sasjs/core/commits?author=saadjutt01" title="Code">💻</a> <a href="#ideas-saadjutt01" title="Ideas, Planning, & Feedback">🤔</a></td>
|
|
270
|
+
<td align="center" valign="top" width="14.28%"><a href="https://www.erudicat.com/"><img src="https://avatars.githubusercontent.com/u/25773492?v=4&size=100" width="100px" height="100px" alt="Yury Shkoda"/><br /><sub><b>Yury Shkoda</b></sub></a><br /><a href="https://github.com/sasjs/core/commits?author=YuryShkoda" title="Code">💻</a> <a href="#infra-YuryShkoda" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a> <a href="#video-YuryShkoda" title="Videos">📹</a></td>
|
|
271
|
+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/medjedovicm"><img src="https://avatars.githubusercontent.com/u/18329105?v=4&size=100" width="100px" height="100px" alt="Mihajlo Medjedovic"/><br /><sub><b>Mihajlo Medjedovic</b></sub></a><br /><a href="#infra-medjedovicm" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a></td>
|
|
272
272
|
</tr>
|
|
273
273
|
<tr>
|
|
274
|
-
<td align="center" valign="top" width="14.28%"><a href="https://github.com/kkchandok"><img src="https://avatars.githubusercontent.com/u/46090627?v=4
|
|
275
|
-
<td align="center" valign="top" width="14.28%"><a href="https://github.com/VladislavParhomchik"><img src="https://avatars.githubusercontent.com/u/83717836?v=4
|
|
276
|
-
<td align="center" valign="top" width="14.28%"><a href="https://github.com/vznesh"><img src="https://avatars.githubusercontent.com/u/28916792?v=4
|
|
277
|
-
<td align="center" valign="top" width="14.28%"><a href="https://github.com/yabwon"><img src="https://avatars.githubusercontent.com/u/9314894?v=4
|
|
278
|
-
<td align="center" valign="top" width="14.28%"><a href="https://bandism.net/"><img src="https://avatars.githubusercontent.com/u/22633385?v=4
|
|
279
|
-
<td align="center" valign="top" width="14.28%"><a href="https://github.com/henrik-forsell"><img src="https://avatars.githubusercontent.com/u/109935936?v=4
|
|
280
|
-
<td align="center" valign="top" width="14.28%"><a href="http://rudvfaden.github.io/"><img src="https://avatars.githubusercontent.com/u/2445577?v=4
|
|
274
|
+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/kkchandok"><img src="https://avatars.githubusercontent.com/u/46090627?v=4&size=100" width="100px" height="100px" alt="kkchandok"/><br /><sub><b>kkchandok</b></sub></a><br /><a href="#ideas-kkchandok" title="Ideas, Planning, & Feedback">🤔</a></td>
|
|
275
|
+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/VladislavParhomchik"><img src="https://avatars.githubusercontent.com/u/83717836?v=4&size=100" width="100px" height="100px" alt="Vladislav Parhomchik"/><br /><sub><b>Vladislav Parhomchik</b></sub></a><br /><a href="https://github.com/sasjs/core/commits?author=VladislavParhomchik" title="Tests">⚠️</a> <a href="https://github.com/sasjs/core/pulls?q=is%3Apr+reviewed-by%3AVladislavParhomchik" title="Reviewed Pull Requests">👀</a></td>
|
|
276
|
+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/vznesh"><img src="https://avatars.githubusercontent.com/u/28916792?v=4&size=100" width="100px" height="100px" alt="Vignesh T."/><br /><sub><b>Vignesh T.</b></sub></a><br /><a href="https://github.com/sasjs/core/issues?q=author%3Avznesh" title="Bug reports">🐛</a></td>
|
|
277
|
+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/yabwon"><img src="https://avatars.githubusercontent.com/u/9314894?v=4&size=100" width="100px" height="100px" alt="Bart Jablonski"/><br /><sub><b>Bart Jablonski</b></sub></a><br /><a href="https://github.com/sasjs/core/commits?author=yabwon" title="Code">💻</a></td>
|
|
278
|
+
<td align="center" valign="top" width="14.28%"><a href="https://bandism.net/"><img src="https://avatars.githubusercontent.com/u/22633385?v=4&size=100" width="100px" height="100px" alt="Ikko Ashimine"/><br /><sub><b>Ikko Ashimine</b></sub></a><br /><a href="https://github.com/sasjs/core/commits?author=eltociear" title="Code">💻</a></td>
|
|
279
|
+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/henrik-forsell"><img src="https://avatars.githubusercontent.com/u/109935936?v=4&size=100" width="100px" height="100px" alt="Henrik Forsell"/><br /><sub><b>Henrik Forsell</b></sub></a><br /><a href="https://github.com/sasjs/core/commits?author=henrik-forsell" title="Documentation">📖</a></td>
|
|
280
|
+
<td align="center" valign="top" width="14.28%"><a href="http://rudvfaden.github.io/"><img src="https://avatars.githubusercontent.com/u/2445577?v=4&size=100" width="100px" height="100px" alt="Rud Faden"/><br /><sub><b>Rud Faden</b></sub></a><br /><a href="https://github.com/sasjs/core/commits?author=rudvfaden" title="Code">💻</a></td>
|
|
281
281
|
</tr>
|
|
282
282
|
<tr>
|
|
283
|
-
<td align="center" valign="top" width="14.28%"><a href="https://github.com/andyjessen"><img src="https://avatars.githubusercontent.com/u/62343929?v=4
|
|
284
|
-
<td align="center" valign="top" width="14.28%"><a href="https://github.com/Nakaya-Ryo"><img src="https://avatars.githubusercontent.com/u/207527203?v=4
|
|
283
|
+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/andyjessen"><img src="https://avatars.githubusercontent.com/u/62343929?v=4&size=100" width="100px" height="100px" alt="andyjessen"/><br /><sub><b>andyjessen</b></sub></a><br /><a href="https://github.com/sasjs/core/commits?author=andyjessen" title="Documentation">📖</a></td>
|
|
284
|
+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/Nakaya-Ryo"><img src="https://avatars.githubusercontent.com/u/207527203?v=4&size=100" width="100px" height="100px" alt="NAKAYA-Ryo"/><br /><sub><b>NAKAYA-Ryo</b></sub></a><br /><a href="https://github.com/sasjs/core/commits?author=Nakaya-Ryo" title="Code">💻</a> <a href="https://github.com/sasjs/core/commits?author=Nakaya-Ryo" title="Tests">⚠️</a></td>
|
|
285
|
+
<td align="center" valign="top" width="14.28%"><a href="https://www.markstudios.com"><img src="https://avatars.githubusercontent.com/u/24554186?v=4&size=100" width="100px" height="100px" alt="Mark Santos"/><br /><sub><b>Mark Santos</b></sub></a><br /><a href="https://github.com/sasjs/core/pulls?q=is%3Apr+reviewed-by%3Amarkksantos" title="Reviewed Pull Requests">👀</a></td>
|
|
285
286
|
</tr>
|
|
286
287
|
</tbody>
|
|
287
288
|
</table>
|
package/base/mf_abort.sas
CHANGED
|
@@ -11,6 +11,11 @@
|
|
|
11
11
|
<h4> Related Macros </h4>
|
|
12
12
|
@li mp_abort.sas
|
|
13
13
|
|
|
14
|
+
@deprecated Use mp_abort.sas. This macro is retained for backwards
|
|
15
|
+
compatibility only: the default SASjs CLI service and test templates still
|
|
16
|
+
declare it as a dependency, and mf_verifymacvars and the viya mfv_* macros
|
|
17
|
+
still call it, so it is not going away. New code should not call it.
|
|
18
|
+
|
|
14
19
|
@version 9.2
|
|
15
20
|
@author Allan Bowe
|
|
16
21
|
@cond
|
package/base/mf_getxengine.sas
CHANGED
|
@@ -12,7 +12,9 @@
|
|
|
12
12
|
|
|
13
13
|
@param [in] fref The fileref to check
|
|
14
14
|
|
|
15
|
-
@returns The XENGINE value in sashelp.vextfl
|
|
15
|
+
@returns The XENGINE value in sashelp.vextfl. A fileref that has a row there
|
|
16
|
+
but no XENGINE value - including a fileref that is not assigned - returns
|
|
17
|
+
an empty string; 0 is returned only when sashelp.vextfl cannot be opened.
|
|
16
18
|
|
|
17
19
|
@version 9.2
|
|
18
20
|
@author Allan Bowe
|
package/base/mf_loc.sas
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
2
|
@file
|
|
3
3
|
@brief Returns physical location of various SAS items
|
|
4
|
-
@details Returns location of the PlatformObjectFramework tools
|
|
5
|
-
Usage:
|
|
4
|
+
@details Returns the location of the PlatformObjectFramework tools, or the
|
|
5
|
+
Viya configuration directory. Usage:
|
|
6
6
|
|
|
7
7
|
%put %mf_loc(POF); %*location of PlatformObjectFramework tools;
|
|
8
8
|
|
|
9
9
|
@param [in] loc The item to locate, eg:
|
|
10
|
-
@li
|
|
11
|
-
@li
|
|
10
|
+
@li PLATFORMOBJECTFRAMEWORK (or POF)
|
|
11
|
+
@li VIYACONFIG
|
|
12
12
|
|
|
13
13
|
@version 9.2
|
|
14
14
|
@author Allan Bowe
|
package/base/mp_guesspk.sas
CHANGED
package/base/mp_include.sas
CHANGED
|
@@ -41,7 +41,6 @@ https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/mcrolref/n1j5tcc0n2xczyn1
|
|
|
41
41
|
%mp_include(example)
|
|
42
42
|
|
|
43
43
|
@param [in] fileref The fileref of the file to be included. Must be provided.
|
|
44
|
-
@param [in] prefix= (_) The prefix to apply to the global variables.
|
|
45
44
|
@param [in] opts= (SOURCE2) The options to apply to the %inc statement
|
|
46
45
|
@param [in] errds= (work.mp_abort_errds) There is no clean way to end a
|
|
47
46
|
process within a %include called within a macro. Furthermore, there is no
|
|
@@ -68,7 +67,6 @@ https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/mcrolref/n1j5tcc0n2xczyn1
|
|
|
68
67
|
**/
|
|
69
68
|
|
|
70
69
|
%macro mp_include(fileref
|
|
71
|
-
,prefix=_
|
|
72
70
|
,opts=SOURCE2
|
|
73
71
|
,errds=work.mp_abort_errds
|
|
74
72
|
)/*/STORE SOURCE*/;
|
package/base/mp_replace.sas
CHANGED
|
@@ -60,12 +60,15 @@
|
|
|
60
60
|
outfile=0
|
|
61
61
|
)/*/STORE SOURCE*/;
|
|
62
62
|
|
|
63
|
-
%local inref dttm ds1;
|
|
63
|
+
%local inref dttm ds1 replen;
|
|
64
64
|
%let inref=%mf_getuniquefileref();
|
|
65
65
|
%let outref=%mf_getuniquefileref();
|
|
66
66
|
%if &outfile=0 %then %let outfile=&infile;
|
|
67
67
|
%let ds1=%mf_getuniquename(prefix=allchars);
|
|
68
68
|
%let ds2=%mf_getuniquename(prefix=startmark);
|
|
69
|
+
/* a blank replacement is a deletion, so the length of the replacement is read
|
|
70
|
+
* once and the characters are simply dropped when it is empty */
|
|
71
|
+
%let replen=%length(%superq(&replacevar));
|
|
69
72
|
|
|
70
73
|
/* START */
|
|
71
74
|
%let dttm=%sysfunc(datetime());
|
|
@@ -136,12 +139,18 @@ run;
|
|
|
136
139
|
filename &outref &outfile recfm=n;
|
|
137
140
|
|
|
138
141
|
data _null_;
|
|
139
|
-
|
|
140
|
-
|
|
142
|
+
%if &replen>0 %then %do;
|
|
143
|
+
length replace $ &replen;
|
|
144
|
+
replace=symget("&replacevar");
|
|
145
|
+
%end;
|
|
141
146
|
file &outref;
|
|
142
147
|
do until(eof);
|
|
143
148
|
set &ds1 end=eof;
|
|
144
|
-
if strt ="1" then
|
|
149
|
+
if strt ="1" then do;
|
|
150
|
+
%if &replen>0 %then %do;
|
|
151
|
+
put replace char.;
|
|
152
|
+
%end;
|
|
153
|
+
end;
|
|
145
154
|
else put sourcechar char1.;
|
|
146
155
|
end;
|
|
147
156
|
stop;
|
package/base/mp_stprequests.sas
CHANGED
|
@@ -52,14 +52,21 @@
|
|
|
52
52
|
SYSUSERID="&sysuserid";
|
|
53
53
|
SYSJOBID="&sysjobid";
|
|
54
54
|
%if not %symexist(_SESSIONID) %then %do;
|
|
55
|
-
/* session id is stored in the replay variable but needs to be extracted
|
|
56
|
-
_replay
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
55
|
+
/* session id is stored in the replay variable but needs to be extracted.
|
|
56
|
+
_replay only exists in a metadata stored process session, so guard it:
|
|
57
|
+
symget() on a name that is not defined raises an error, not a blank. */
|
|
58
|
+
%if %symexist(_replay) %then %do;
|
|
59
|
+
_replay=symget('_replay');
|
|
60
|
+
_replay=subpad(_replay,index(_replay,'_sessionid=')+11,length(_replay));
|
|
61
|
+
index=index(_replay,'&')-1;
|
|
62
|
+
if index=-1 then index=length(_replay);
|
|
63
|
+
_replay=substr(_replay,1,index);
|
|
64
|
+
_SESSIONID=_replay;
|
|
65
|
+
drop _replay index;
|
|
66
|
+
%end;
|
|
67
|
+
%else %do;
|
|
68
|
+
_SESSIONID="";
|
|
69
|
+
%end;
|
|
63
70
|
%end;
|
|
64
71
|
%else %do;
|
|
65
72
|
/* explicitly created sessions are automatically available */
|
|
@@ -50,10 +50,15 @@ proc sql;
|
|
|
50
50
|
drop table &lib..&ds;
|
|
51
51
|
|
|
52
52
|
data &outds;
|
|
53
|
+
_start=&start;
|
|
54
|
+
_end=datetime();
|
|
53
55
|
lib="&lib";
|
|
54
|
-
start_dttm=put(
|
|
55
|
-
end_dttm=put(
|
|
56
|
-
|
|
56
|
+
start_dttm=put(_start,datetime19.);
|
|
57
|
+
end_dttm=put(_end,datetime19.);
|
|
58
|
+
/* both timestamps above are text, so the difference has to come from the
|
|
59
|
+
numeric values - subtracting the strings yields a missing value */
|
|
60
|
+
duration_seconds=_end-_start;
|
|
61
|
+
drop _start _end;
|
|
57
62
|
run;
|
|
58
63
|
|
|
59
64
|
%mend mp_testwritespeedlibrary;
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
@li mf_existvar.sas
|
|
25
25
|
@li mf_getvarlen.sas
|
|
26
26
|
@li mf_getvartype.sas
|
|
27
|
-
@li
|
|
27
|
+
@li mf_nobs.sas
|
|
28
28
|
@li mp_createconstraints.sas
|
|
29
29
|
@li mp_getconstraints.sas
|
|
30
30
|
@li mp_deleteconstraints.sas
|
|
@@ -74,7 +74,7 @@ data;run;
|
|
|
74
74
|
,msg=%str(syscc=&syscc)
|
|
75
75
|
)
|
|
76
76
|
|
|
77
|
-
%if %
|
|
77
|
+
%if %mf_nobs(&dsconst)=0 %then %do;
|
|
78
78
|
/* must use SQL as proc datasets does not support length changes */
|
|
79
79
|
proc sql;
|
|
80
80
|
alter table &libds modify &var char(&len);
|
package/base/mp_wait4file.sas
CHANGED
|
@@ -21,8 +21,9 @@
|
|
|
21
21
|
|
|
22
22
|
%macro mp_wait4file(file, maxwait=0, interval=1);
|
|
23
23
|
|
|
24
|
-
%if %
|
|
25
|
-
%put
|
|
24
|
+
%if %length(&file)=0 %then %do;
|
|
25
|
+
%put NOTE: &sysmacroname: no file was provided so it returns immediately;
|
|
26
|
+
%return;
|
|
26
27
|
%end;
|
|
27
28
|
|
|
28
29
|
data _null_;
|
package/package.json
CHANGED
package/viya/mv_getjobresult.sas
CHANGED
|
@@ -89,6 +89,7 @@
|
|
|
89
89
|
<h4> SAS Macros </h4>
|
|
90
90
|
@li mp_abort.sas
|
|
91
91
|
@li mp_binarycopy.sas
|
|
92
|
+
@li mp_replace.sas
|
|
92
93
|
@li mf_getplatform.sas
|
|
93
94
|
@li mf_existfileref.sas
|
|
94
95
|
@li mf_getuniquefileref.sas
|
|
@@ -281,7 +282,60 @@ run;
|
|
|
281
282
|
%mp_binarycopy(inref=&fname2,outref=&outref)
|
|
282
283
|
%end;
|
|
283
284
|
%if &outlib ne 0 %then %do;
|
|
284
|
-
|
|
285
|
+
/* A service run through Viya job execution wraps its response in the
|
|
286
|
+
* transport envelope (>>weboutBEGIN<< ... >>weboutEND<<) - that is what the
|
|
287
|
+
* client frames the response with. The text path in mx_execute strips it,
|
|
288
|
+
* but the JSON engine has no such step and rejects the marker on line one,
|
|
289
|
+
* which is why an aborted child's result looked unparsable when the abort
|
|
290
|
+
* object inside it was perfectly good.
|
|
291
|
+
*
|
|
292
|
+
* Detection is the strip: mp_replace copies a byte at a time, so the markers
|
|
293
|
+
* come out wherever they sit, and a smaller output than input is the answer
|
|
294
|
+
* to "was there an envelope". Probing the first record instead would miss a
|
|
295
|
+
* marker that is not in it, which is the failure this exists to remove,
|
|
296
|
+
* and a result without an envelope keeps the direct libname. */
|
|
297
|
+
%local path2 path3 begvar endvar nil fref3 fref4 fid size2 size4;
|
|
298
|
+
%let fref3=%mf_getuniquefileref();
|
|
299
|
+
%let fref4=%mf_getuniquefileref();
|
|
300
|
+
%let path2=%sysfunc(pathname(&fname2));
|
|
301
|
+
%let path3=%sysfunc(pathname(&fref3));
|
|
302
|
+
%let begvar=%str(>>weboutBEGIN<<);
|
|
303
|
+
%let endvar=%str(>>weboutEND<<);
|
|
304
|
+
%let nil=;
|
|
305
|
+
%mp_replace(infile="&path2",findvar=begvar,replacevar=nil
|
|
306
|
+
,outfile="&path3")
|
|
307
|
+
%mp_replace(infile="&path3",findvar=endvar,replacevar=nil
|
|
308
|
+
,outfile="%sysfunc(pathname(&fref4))")
|
|
309
|
+
/* a copy that could not be written is not an outcome: say so, rather than
|
|
310
|
+
* handing the engine an empty file and failing at the libname instead */
|
|
311
|
+
%if %sysfunc(fexist(&fref4)) ne 1 %then %do;
|
|
312
|
+
%mp_abort(mac=&sysmacroname
|
|
313
|
+
,msg=%str(Unable to strip the result envelope for &uri)
|
|
314
|
+
)
|
|
315
|
+
%end;
|
|
316
|
+
%let fid=%sysfunc(fopen(&fname2));
|
|
317
|
+
%let size2=%sysfunc(finfo(&fid,File Size (bytes)));
|
|
318
|
+
%let fid=%sysfunc(fclose(&fid));
|
|
319
|
+
%let fid=%sysfunc(fopen(&fref4));
|
|
320
|
+
%let size4=%sysfunc(finfo(&fid,File Size (bytes)));
|
|
321
|
+
%let fid=%sysfunc(fclose(&fid));
|
|
322
|
+
%if &size4 < &size2 %then %do;
|
|
323
|
+
/* nothing but envelope is a real outcome - a service that aborted before
|
|
324
|
+
* writing anything - and becomes the empty object the not-found branch
|
|
325
|
+
* hands back, rather than an empty file the engine cannot open */
|
|
326
|
+
%if &size4=0 %then %do;
|
|
327
|
+
data _null_;
|
|
328
|
+
file &fref4;
|
|
329
|
+
put '{}';
|
|
330
|
+
run;
|
|
331
|
+
%end;
|
|
332
|
+
libname &outlib JSON fileref=&fref4;
|
|
333
|
+
%end;
|
|
334
|
+
%else %do;
|
|
335
|
+
libname &outlib JSON fileref=&fname2;
|
|
336
|
+
%end;
|
|
337
|
+
filename &fref3 clear;
|
|
338
|
+
filename &fref4 clear;
|
|
285
339
|
%end;
|
|
286
340
|
|
|
287
341
|
%if &mdebug=0 %then %do;
|
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
automate the generation of clients & secrets with various settings).
|
|
13
13
|
|
|
14
14
|
For further information on clients / secrets, see;
|
|
15
|
-
@li https://developer.sas.com/
|
|
16
|
-
@li https://
|
|
15
|
+
@li https://developer.sas.com/docs/rest-apis/getting-started/authentication
|
|
16
|
+
@li https://blogs.sas.com/content/sgf/2023/02/07/authentication-to-sas-viya/
|
|
17
17
|
@li https://cli.sasjs.io/faq/#how-can-i-obtain-a-viya-client-and-secret
|
|
18
18
|
|
|
19
19
|
The default viyaroot location is: `/opt/sas/viya/config`
|
package/base/mp_runddl.sas
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
@file mp_runddl.sas
|
|
3
|
-
@brief An opinionated way to execute DDL files in SAS.
|
|
4
|
-
@details When delivering projects there should be seperation between the DDL
|
|
5
|
-
used to generate the tables and the sample data used to populate them.
|
|
6
|
-
|
|
7
|
-
This macro expects certain folder structure - eg:
|
|
8
|
-
|
|
9
|
-
rootlib
|
|
10
|
-
|-- LIBREF1
|
|
11
|
-
| |__ mytable.ddl
|
|
12
|
-
| |__ someothertable.ddl
|
|
13
|
-
|-- LIBREF2
|
|
14
|
-
| |__ table1.ddl
|
|
15
|
-
| |__ table2.ddl
|
|
16
|
-
|-- LIBREF3
|
|
17
|
-
|__ table3.ddl
|
|
18
|
-
|__ table4.ddl
|
|
19
|
-
|
|
20
|
-
Only files with the .ddl suffix are executed. The parent folder name is used
|
|
21
|
-
as the libref.
|
|
22
|
-
Files should NOT contain the `proc sql` statement - this is to prevent
|
|
23
|
-
statements being executed if there is an err condition.
|
|
24
|
-
|
|
25
|
-
Usage:
|
|
26
|
-
|
|
27
|
-
%mp_runddl(/some/rootlib) * execute all libs ;
|
|
28
|
-
|
|
29
|
-
%mp_runddl(/some/rootlib, inc=LIBREF1 LIBREF2) * include only these libs;
|
|
30
|
-
|
|
31
|
-
%mp_runddl(/some/rootlib, exc=LIBREF3) * same as above ;
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
@param [in] path location of the DDL folder structure
|
|
35
|
-
@param [in] inc= list of librefs to include
|
|
36
|
-
@param [in] exc= list of librefs to exclude (takes precedence over inc=)
|
|
37
|
-
|
|
38
|
-
@version 9.3
|
|
39
|
-
@author Allan Bowe
|
|
40
|
-
@source https://github.com/sasjs/core
|
|
41
|
-
|
|
42
|
-
**/
|
|
43
|
-
|
|
44
|
-
%macro mp_runddl(path, inc=, exc=
|
|
45
|
-
)/*/STORE SOURCE*/;
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
%mend mp_runddl;
|