@sasjs/core 4.22.0 → 4.23.2

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 CHANGED
@@ -18,7 +18,7 @@
18
18
  [dependency-url]:https://github.com/sasjs/core/blob/main/package.json
19
19
 
20
20
 
21
- Much quality. Many standards. The **Macro Core** library exists to save time and development effort! Herein ye shall find a veritable host of MIT-licenced, production quality SAS macros. These are a mix of tools, utilities, functions and code generators that are useful in the context of [Application Development](https://sasapps.io) on the SAS platform (eg https://datacontroller.io). [Contributions](https://github.com/sasjs/core/blob/main/CONTRIBUTING.md) are welcomed.
21
+ Much quality. Many standards. The **Macro Core** library exists to save time and development effort! Herein ye shall find a veritable host of MIT-licenced, production quality SAS macros. These are a mix of tools, utilities, functions and code generators that are useful in the context of [Application Development](https://sasapps.io) on the SAS platform (eg https://datacontroller.io). [Contributions](https://github.com/sasjs/core/blob/main/.github/CONTRIBUTING.md) are welcome.
22
22
 
23
23
  You can download and compile them all in just two lines of SAS code:
24
24
 
@@ -224,12 +224,13 @@ The following repositories are also worth checking out:
224
224
  * [chris-swenson/sasmacros](https://github.com/chris-swenson/sasmacros)
225
225
  * [greg-wotton/sas-programs](https://github.com/greg-wootton/sas-programs)
226
226
  * [KatjaGlassConsulting/SMILE-SmartSASMacros](https://github.com/KatjaGlassConsulting/SMILE-SmartSASMacros)
227
+ * [rogerjdeangelis](https://github.com/rogerjdeangelis)
227
228
  * [scottbass/sas](https://github.com/scottbass/SAS)
228
229
  * [yabwon/sas_packages](https://github.com/yabwon/SAS_PACKAGES)
229
230
 
230
231
  ## Contributors ✨
231
232
  <!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
232
- [![All Contributors](https://img.shields.io/badge/all_contributors-11-orange.svg?style=flat-square)](#contributors-)
233
+ [![All Contributors](https://img.shields.io/badge/all_contributors-12-orange.svg?style=flat-square)](#contributors-)
233
234
  <!-- ALL-CONTRIBUTORS-BADGE:END -->
234
235
  Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
235
236
 
@@ -251,6 +252,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
251
252
  <td align="center"><a href="https://github.com/VladislavParhomchik"><img src="https://avatars.githubusercontent.com/u/83717836?v=4?s=100" width="100px;" alt=""/><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>
252
253
  <td align="center"><a href="https://github.com/vznesh"><img src="https://avatars.githubusercontent.com/u/28916792?v=4?s=100" width="100px;" alt=""/><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>
253
254
  <td align="center"><a href="https://github.com/yabwon"><img src="https://avatars.githubusercontent.com/u/9314894?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Bart Jablonski</b></sub></a><br /><a href="https://github.com/sasjs/core/commits?author=yabwon" title="Code">💻</a></td>
255
+ <td align="center"><a href="https://bandism.net/"><img src="https://avatars.githubusercontent.com/u/22633385?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Ikko Ashimine</b></sub></a><br /><a href="https://github.com/sasjs/core/commits?author=eltociear" title="Code">💻</a></td>
254
256
  </tr>
255
257
  </table>
256
258
 
@@ -0,0 +1,42 @@
1
+ /**
2
+ @file
3
+ @brief Returns E8601DT26.6 if compatible else DATETIME19.3
4
+ @details From our experience in [Data Controller for SAS]
5
+ (https://datacontroller.io) deployments, the E8601DT26.6 datetime format has
6
+ the widest support when it comes to pass-through SQL queries.
7
+
8
+ However, it is not supported in WPS or early versions of SAS 9 (M3 and below)
9
+ when used as a datetime literal, eg:
10
+
11
+ data _null_;
12
+ demo="%sysfunc(datetime(),E8601DT26.6)"dt;
13
+ demo=;
14
+ run;
15
+
16
+ This macro will therefore return DATEITME19.3 as an alternative format
17
+ based on the runtime environment so that it can be used in such cases, eg:
18
+
19
+ data _null_;
20
+ demo="%sysfunc(datetime(),%mf_fmtdttm())"dt;
21
+ demo=;
22
+ run;
23
+
24
+ <h4> Related Macros </h4>
25
+ @li mf_fmtdttm.test.sas
26
+
27
+ @author Allan Bowe
28
+ **/
29
+
30
+ %macro mf_fmtdttm(
31
+ )/*/STORE SOURCE*/;
32
+
33
+ %if "&sysver"="9.2" or "&sysver"="9.3"
34
+ or ("&sysver"="9.4" and "%substr(&SYSVLONG,9,1)" le "3")
35
+ or "%substr(&sysver,1,1)"="4"
36
+ or "%substr(&sysver,1,1)"="5"
37
+ %then %do;DATETIME19.3%end;
38
+ %else %do;E8601DT26.6%end;
39
+
40
+ %mend mf_fmtdttm;
41
+
42
+
@@ -40,6 +40,22 @@
40
40
  %let lib=%upcase(&lib);
41
41
  %let ds=%upcase(&ds);
42
42
 
43
+ /**
44
+ * Cater for environments where sashelp.vcncolu is not available
45
+ */
46
+ %if %sysfunc(exist(sashelp.vcncolu,view))=0 %then %do;
47
+ proc sql;
48
+ create table &outds(
49
+ libref char(8)
50
+ ,TABLE_NAME char(32)
51
+ ,constraint_type char(8) label='Constraint Type'
52
+ ,constraint_name char(32) label='Constraint Name'
53
+ ,column_name char(32) label='Column'
54
+ ,constraint_order num
55
+ );
56
+ %return;
57
+ %end;
58
+
43
59
  /**
44
60
  * Neither dictionary tables nor sashelp provides a constraint order column,
45
61
  * however they DO arrive in the correct order. So, create the col.
@@ -22,6 +22,7 @@
22
22
  @param [in] loop_secs= (1) Seconds to wait between each lock attempt
23
23
 
24
24
  <h4> SAS Macros </h4>
25
+ @li mf_fmtdttm.sas
25
26
  @li mp_abort.sas
26
27
  @li mp_lockfilecheck.sas
27
28
  @li mf_getuser.sas
@@ -111,7 +112,7 @@ run;
111
112
  LOCK_LIB ="&lib";
112
113
  LOCK_DS="&ds";
113
114
  LOCK_STATUS_CD='LOCKED';
114
- LOCK_START_DTTM="%sysfunc(datetime(),E8601DT26.6)"dt;
115
+ LOCK_START_DTTM="%sysfunc(datetime(),%mf_fmtdttm())"dt;
115
116
  LOCK_USER_NM="&user";
116
117
  LOCK_PID="&sysjobid";
117
118
  LOCK_REF="&ref";
@@ -131,7 +132,7 @@ run;
131
132
  proc sql;
132
133
  update &ctl_ds
133
134
  set LOCK_STATUS_CD='LOCKED'
134
- , LOCK_START_DTTM="%sysfunc(datetime(),E8601DT26.6)"dt
135
+ , LOCK_START_DTTM="%sysfunc(datetime(),%mf_fmtdttm())"dt
135
136
  , LOCK_USER_NM="&user"
136
137
  , LOCK_PID="&sysjobid"
137
138
  , LOCK_REF="&ref"
@@ -206,7 +207,7 @@ run;
206
207
  proc sql;
207
208
  update &ctl_ds
208
209
  set LOCK_STATUS_CD='UNLOCKED'
209
- , LOCK_END_DTTM="%sysfunc(datetime(),E8601DT26.6)"dt
210
+ , LOCK_END_DTTM="%sysfunc(datetime(),%mf_fmtdttm())"dt
210
211
  , LOCK_USER_NM="&user"
211
212
  , LOCK_PID="&sysjobid"
212
213
  , LOCK_REF="&ref"
@@ -58,6 +58,7 @@
58
58
 
59
59
  <h4> SAS Macros </h4>
60
60
  @li mf_existvar.sas
61
+ @li mf_fmtdttm.sas
61
62
  @li mf_getquotedstr.sas
62
63
  @li mf_getuniquename.sas
63
64
  @li mf_nobs.sas
@@ -217,12 +218,12 @@ quit;
217
218
  set keytable="&base_libds"
218
219
  ,keycolumn="&retained_key"
219
220
  ,max_key=%eval(&maxkey+&newkey_cnt)
220
- ,processed_dttm="%sysfunc(datetime(),E8601DT26.6)"dt;
221
+ ,processed_dttm="%sysfunc(datetime(),%mf_fmtdttm())"dt;
221
222
  %end;
222
223
  %else %do;
223
224
  update &maxkeytable
224
225
  set max_key=%eval(&maxkey+&newkey_cnt)
225
- ,processed_dttm="%sysfunc(datetime(),E8601DT26.6)"dt
226
+ ,processed_dttm="%sysfunc(datetime(),%mf_fmtdttm())"dt
226
227
  where keytable="&base_libds";
227
228
  %end;
228
229
  %mp_lockanytable(UNLOCK
@@ -14,8 +14,8 @@ proc sql;
14
14
  create table &libds(
15
15
  FMTNAME char(32) label='Format name'
16
16
  /*
17
- to accomodate larger START values, mp_loadformat.sas will need the
18
- SQL dependency removed (proc sql needs to accomodate 3 index values in
17
+ to accommodate larger START values, mp_loadformat.sas will need the
18
+ SQL dependency removed (proc sql needs to accommodate 3 index values in
19
19
  a 32767 ibufsize limit)
20
20
  */
21
21
  ,START char(10000) label='Starting value for format'
@@ -40,4 +40,4 @@ create table &libds(
40
40
  ,LANGUAGE char(8) label='Language for date strings'
41
41
  );
42
42
 
43
- %mend mddl_sas_cntlout;
43
+ %mend mddl_sas_cntlout;
package/main.dox ADDED
@@ -0,0 +1,95 @@
1
+
2
+ /** \dir .
3
+ * \brief Open Source Macro Library for Developers of the SAS Language. See: https://github.com/sasjs/core
4
+ * \details To use - add the subfolders to your `SASAUTOS` call path.
5
+ */
6
+
7
+
8
+ /*! \dir base
9
+ * \brief Regular Base SAS Macros
10
+ * \details These macros have the following attributes:
11
+
12
+ * OS independent
13
+ * Not metadata aware
14
+ * No X command
15
+ * Prefixes: _mf_, _mp_
16
+
17
+ Macros starting `mf_` are macro _functions_ and can be used in assignment
18
+ statements. Those starting `mp_` are macro _procedures_, which generate
19
+ SAS statements, and must therefore be applied accordingly.
20
+
21
+ */
22
+
23
+ /*! \dir fcmp
24
+ * \brief Macros for generating FCMP functions
25
+ * \details These macros have the following attributes:
26
+
27
+ * Macro name matches compiled function / subroutine name
28
+ * Prefixes: _mcf_, _mcs_
29
+
30
+ The macro part is just a wrapper for the underlying function / subroutine,
31
+ and has switches for including the proc fcmp / quit statements and whether
32
+ to insert the package into the CMPLIB option.
33
+
34
+ */
35
+
36
+ /*! \dir meta
37
+ * \brief Metadata Aware Macros
38
+ * \details These macros have the following attributes:
39
+
40
+ * OS independent
41
+ * Metadata aware
42
+ * No X command
43
+ * Prefixes: _mm_
44
+
45
+ */
46
+
47
+ /*! \dir metax
48
+ * \brief Metadata Aware Macros with X commmand
49
+ * \details These macros have the following attributes:
50
+
51
+ * OS independent
52
+ * Metadata aware
53
+ * X command
54
+ * Prefixes: _mmx_, _mmw_, _mmu_
55
+
56
+ */
57
+
58
+ /*! \dir server
59
+ * \brief Macros used with [sasjs/server](https://server.sasjs.io)
60
+ * \details These macros have the following attributes:
61
+
62
+ * OS independent
63
+ * sasjs/server aware
64
+ * No X command
65
+ * Prefixes: _ms_
66
+
67
+ */
68
+
69
+ /*! \dir tests
70
+ * \brief SASjs Tests
71
+ * \details These folders contain the macro tests. They are first compiled
72
+ and deployed (sasjs cbd) then executed (sasjs test).
73
+
74
+ */
75
+
76
+ /*! \dir viya
77
+ * \brief Viya macros
78
+ * \details These macros have the following attributes:
79
+
80
+ * OS independent
81
+ * No X command
82
+ * Prefixes: _mv_
83
+
84
+ */
85
+
86
+ /*! \dir lua
87
+ * \brief Lua macros
88
+ * \details These macros have the following attributes:
89
+
90
+ * OS independent
91
+ * Work as LUA functions (they are immediately executed/compiled)
92
+ * Auto-generated from the plain source `.lua` files in the same directory
93
+ * Prefixes: _ml_
94
+
95
+ */
package/package.json CHANGED
@@ -35,5 +35,5 @@
35
35
  "devDependencies": {
36
36
  "@sasjs/cli": "3.13.0"
37
37
  },
38
- "version": "4.22.0"
38
+ "version": "4.23.2"
39
39
  }
@@ -68,8 +68,8 @@ data _null_;
68
68
  file &fname1 lrecl=1000;
69
69
  infile "&_sasjs_tokenfile" lrecl=1000;
70
70
  input;
71
- put "Content-Type: multipart/form-data; boundary=&boundary";
72
- put "Authorization: Bearer " _infile_;
71
+ if _n_=1 then put "Content-Type: multipart/form-data; boundary=&boundary";
72
+ put _infile_;
73
73
  run;
74
74
 
75
75
  %if &mdebug=1 %then %do;
@@ -87,9 +87,11 @@ data _null_;
87
87
  file &fref1 lrecl=1000;
88
88
  infile "&_sasjs_tokenfile" lrecl=1000;
89
89
  input;
90
- put "Authorization: Bearer " _infile_;
91
- put "Content-Type: application/json";
92
- put "accept: application/json";
90
+ if _n_=1 then do;
91
+ put "Content-Type: application/json";
92
+ put "accept: application/json";
93
+ end;
94
+ put _infile_;
93
95
  run;
94
96
 
95
97
  %if &mdebug=1 %then %do;
@@ -33,7 +33,7 @@ data _null_;
33
33
  file &headref lrecl=1000;
34
34
  infile "&_sasjs_tokenfile" lrecl=1000;
35
35
  input;
36
- put "Authorization: Bearer " _infile_;
36
+ put _infile_;
37
37
  run;
38
38
 
39
39
  proc http method='DELETE' headerin=&headref
@@ -34,7 +34,7 @@ data _null_;
34
34
  file &headref lrecl=1000;
35
35
  infile "&_sasjs_tokenfile" lrecl=1000;
36
36
  input;
37
- put "Authorization: Bearer " _infile_;
37
+ put _infile_;
38
38
  run;
39
39
 
40
40
  proc http method='GET' out=&binaryfref headerin=&headref
@@ -56,8 +56,8 @@ data _null_;
56
56
  file &fref0 lrecl=1000;
57
57
  infile "&_sasjs_tokenfile" lrecl=1000;
58
58
  input;
59
- put "Authorization: Bearer " _infile_;
60
- put "accept: application/json";
59
+ if _n_=1 then put "accept: application/json";
60
+ put _infile_;
61
61
  run;
62
62
 
63
63
  %if &mdebug=1 %then %do;
@@ -137,8 +137,8 @@ data _null_;
137
137
  file &authref lrecl=1000;
138
138
  infile "&_sasjs_tokenfile" lrecl=1000;
139
139
  input;
140
- put 'Authorization: Bearer ' _infile_;
141
- put "Content-Type: multipart/form-data; boundary=&boundary";
140
+ if _n_=1 then put "Content-Type: multipart/form-data; boundary=&boundary";
141
+ put _infile_;
142
142
  run;
143
143
 
144
144
  %if &mdebug=1 %then %do;