@sasjs/core 4.18.15 → 4.18.18

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.
@@ -199,19 +199,23 @@
199
199
  format _numeric_ bart.;
200
200
  %do i=1 %to &numcols;
201
201
  %if &&typelong&i=char or &fmt=Y %then %do;
202
- &&name&i='"'!!trim(prxchange('s/"/\"/',-1,
203
- prxchange('s/'!!'0A'x!!'/\n/',-1,
204
- prxchange('s/'!!'0D'x!!'/\r/',-1,
205
- prxchange('s/'!!'09'x!!'/\t/',-1,
206
- prxchange('s/\x00/\\u0000/',-1, /* NUL */
207
- prxchange('s/\x0E/\\u000E/',-1, /* SS */
208
- prxchange('s/\x0F/\\u000F/',-1, /* SF */
209
- prxchange('s/\x01/\\u0001/',-1, /* SOH */
210
- prxchange('s/\x02/\\u0002/',-1, /* STX */
211
- prxchange('s/\x10/\\u0010/',-1, /* DLE */
212
- prxchange('s/\x11/\\u0011/',-1, /* DC1 */
213
- prxchange('s/\\/\\\\/',-1,&&name&i)
214
- ))))))))))))!!'"';
202
+ if findc(&&name&i,'"\'!!'0A0D09000E0F01021011'x) then do;
203
+ &&name&i='"'!!trim(
204
+ prxchange('s/"/\\"/',-1, /* double quote */
205
+ prxchange('s/\x0A/\n/',-1, /* new line */
206
+ prxchange('s/\x0D/\r/',-1, /* carriage return */
207
+ prxchange('s/\x09/\\t/',-1, /* tab */
208
+ prxchange('s/\x00/\\u0000/',-1, /* NUL */
209
+ prxchange('s/\x0E/\\u000E/',-1, /* SS */
210
+ prxchange('s/\x0F/\\u000F/',-1, /* SF */
211
+ prxchange('s/\x01/\\u0001/',-1, /* SOH */
212
+ prxchange('s/\x02/\\u0002/',-1, /* STX */
213
+ prxchange('s/\x10/\\u0010/',-1, /* DLE */
214
+ prxchange('s/\x11/\\u0011/',-1, /* DC1 */
215
+ prxchange('s/\\/\\\\/',-1,&&name&i)
216
+ ))))))))))))!!'"';
217
+ end;
218
+ else &&name&i=quote(cats(&&name&i));
215
219
  %end;
216
220
  %end;
217
221
  run;
@@ -232,19 +232,23 @@ data _null_;
232
232
  put ' format _numeric_ bart.; ';
233
233
  put ' %do i=1 %to &numcols; ';
234
234
  put ' %if &&typelong&i=char or &fmt=Y %then %do; ';
235
- put ' &&name&i=''"''!!trim(prxchange(''s/"/\"/'',-1, ';
236
- put ' prxchange(''s/''!!''0A''x!!''/\n/'',-1, ';
237
- put ' prxchange(''s/''!!''0D''x!!''/\r/'',-1, ';
238
- put ' prxchange(''s/''!!''09''x!!''/\t/'',-1, ';
239
- put ' prxchange(''s/\x00/\\u0000/'',-1, /* NUL */ ';
240
- put ' prxchange(''s/\x0E/\\u000E/'',-1, /* SS */ ';
241
- put ' prxchange(''s/\x0F/\\u000F/'',-1, /* SF */ ';
242
- put ' prxchange(''s/\x01/\\u0001/'',-1, /* SOH */ ';
243
- put ' prxchange(''s/\x02/\\u0002/'',-1, /* STX */ ';
244
- put ' prxchange(''s/\x10/\\u0010/'',-1, /* DLE */ ';
245
- put ' prxchange(''s/\x11/\\u0011/'',-1, /* DC1 */ ';
246
- put ' prxchange(''s/\\/\\\\/'',-1,&&name&i) ';
247
- put ' ))))))))))))!!''"''; ';
235
+ put ' if findc(&&name&i,''"\''!!''0A0D09000E0F01021011''x) then do; ';
236
+ put ' &&name&i=''"''!!trim( ';
237
+ put ' prxchange(''s/"/\\"/'',-1, /* double quote */ ';
238
+ put ' prxchange(''s/\x0A/\n/'',-1, /* new line */ ';
239
+ put ' prxchange(''s/\x0D/\r/'',-1, /* carriage return */ ';
240
+ put ' prxchange(''s/\x09/\\t/'',-1, /* tab */ ';
241
+ put ' prxchange(''s/\x00/\\u0000/'',-1, /* NUL */ ';
242
+ put ' prxchange(''s/\x0E/\\u000E/'',-1, /* SS */ ';
243
+ put ' prxchange(''s/\x0F/\\u000F/'',-1, /* SF */ ';
244
+ put ' prxchange(''s/\x01/\\u0001/'',-1, /* SOH */ ';
245
+ put ' prxchange(''s/\x02/\\u0002/'',-1, /* STX */ ';
246
+ put ' prxchange(''s/\x10/\\u0010/'',-1, /* DLE */ ';
247
+ put ' prxchange(''s/\x11/\\u0011/'',-1, /* DC1 */ ';
248
+ put ' prxchange(''s/\\/\\\\/'',-1,&&name&i) ';
249
+ put ' ))))))))))))!!''"''; ';
250
+ put ' end; ';
251
+ put ' else &&name&i=quote(cats(&&name&i)); ';
248
252
  put ' %end; ';
249
253
  put ' %end; ';
250
254
  put ' run; ';
package/package.json CHANGED
@@ -35,5 +35,5 @@
35
35
  "devDependencies": {
36
36
  "@sasjs/cli": "3.13.0"
37
37
  },
38
- "version": "4.18.15"
38
+ "version": "4.18.18"
39
39
  }
@@ -61,8 +61,11 @@ data _null_;
61
61
  run;
62
62
 
63
63
  data _null_;
64
- file &fname1;
64
+ file &fname1 lrecl=1000;
65
+ infile "&_sasjs_tokenfile" lrecl=1000;
66
+ input;
65
67
  put "Content-Type: multipart/form-data; boundary=&boundary";
68
+ put "Authorization: Bearer " _infile_;
66
69
  run;
67
70
 
68
71
  %if &mdebug=1 %then %do;
@@ -17,6 +17,8 @@
17
17
  @param [in] driveloc The full path to the file in SASjs Drive
18
18
  @param [in] mdebug= (0) Set to 1 to enable DEBUG messages
19
19
 
20
+ <h4> SAS Macros </h4>
21
+ @li mf_getuniquefileref.sas
20
22
 
21
23
  **/
22
24
 
@@ -24,12 +26,23 @@
24
26
  ,mdebug=0
25
27
  );
26
28
 
27
- proc http method='DELETE'
29
+ %local headref;
30
+ %let headref=%mf_getuniquefileref();
31
+
32
+ data _null_;
33
+ file &headref lrecl=1000;
34
+ infile "&_sasjs_tokenfile" lrecl=1000;
35
+ input;
36
+ put "Authorization: Bearer " _infile_;
37
+ run;
38
+
39
+ proc http method='DELETE' headerin=&headref
28
40
  url="&_sasjs_apiserverurl/SASjsApi/drive/file?_filePath=&driveloc";
29
41
  %if &mdebug=1 %then %do;
30
42
  debug level=2;
31
43
  %end;
32
44
  run;
33
45
 
46
+ filename &headref clear;
34
47
 
35
48
  %mend ms_deletefile;
@@ -5,7 +5,7 @@
5
5
 
6
6
  Example:
7
7
 
8
- %ms_getfile(/some/stored/file.ext, outref=myfile)
8
+ %ms_getfile(/Public/app/dc/services/public/settings.sas, outref=myfile)
9
9
 
10
10
  @param [in] driveloc The full path to the file in SASjs Drive
11
11
  @param [out] outref= (msgetfil) The fileref to contain the file.
@@ -23,13 +23,21 @@
23
23
  );
24
24
 
25
25
  /* use the recfm in a separate fileref to avoid issues with subsequent reads */
26
- %local binaryfref floc;
26
+ %local binaryfref floc headref;
27
27
  %let binaryfref=%mf_getuniquefileref();
28
+ %let headref=%mf_getuniquefileref();
28
29
  %let floc=%sysfunc(pathname(work))/%mf_getuniquename().txt;
29
- filename &outref "&floc";
30
+ filename &outref "&floc" lrecl=32767;
30
31
  filename &binaryfref "&floc" recfm=n;
31
32
 
32
- proc http method='GET' out=&binaryfref
33
+ data _null_;
34
+ file &headref lrecl=1000;
35
+ infile "&_sasjs_tokenfile" lrecl=1000;
36
+ input;
37
+ put "Authorization: Bearer " _infile_;
38
+ run;
39
+
40
+ proc http method='GET' out=&binaryfref headerin=&headref
33
41
  url="&_sasjs_apiserverurl/SASjsApi/drive/file?_filePath=&driveloc";
34
42
  %if &mdebug=1 %then %do;
35
43
  debug level=2;
@@ -37,5 +45,6 @@ proc http method='GET' out=&binaryfref
37
45
  run;
38
46
 
39
47
  filename &binaryfref clear;
48
+ filename &headref clear;
40
49
 
41
- %mend ms_getfile;
50
+ %mend ms_getfile;
@@ -43,10 +43,10 @@
43
43
  )
44
44
 
45
45
  data _null_;
46
- file &fname1;
47
- infile "&_sasjs_tokenfile";
46
+ file &fname1 lrecl=1000;
47
+ infile "&_sasjs_tokenfile" lrecl=1000;
48
48
  input;
49
- put 'Authorization: Bearer' _infile_;
49
+ put 'Authorization: Bearer ' _infile_;
50
50
  run;
51
51
 
52
52
  filename &outref temp;
@@ -376,19 +376,23 @@ data _null_;
376
376
  put ' format _numeric_ bart.; ';
377
377
  put ' %do i=1 %to &numcols; ';
378
378
  put ' %if &&typelong&i=char or &fmt=Y %then %do; ';
379
- put ' &&name&i=''"''!!trim(prxchange(''s/"/\"/'',-1, ';
380
- put ' prxchange(''s/''!!''0A''x!!''/\n/'',-1, ';
381
- put ' prxchange(''s/''!!''0D''x!!''/\r/'',-1, ';
382
- put ' prxchange(''s/''!!''09''x!!''/\t/'',-1, ';
383
- put ' prxchange(''s/\x00/\\u0000/'',-1, /* NUL */ ';
384
- put ' prxchange(''s/\x0E/\\u000E/'',-1, /* SS */ ';
385
- put ' prxchange(''s/\x0F/\\u000F/'',-1, /* SF */ ';
386
- put ' prxchange(''s/\x01/\\u0001/'',-1, /* SOH */ ';
387
- put ' prxchange(''s/\x02/\\u0002/'',-1, /* STX */ ';
388
- put ' prxchange(''s/\x10/\\u0010/'',-1, /* DLE */ ';
389
- put ' prxchange(''s/\x11/\\u0011/'',-1, /* DC1 */ ';
390
- put ' prxchange(''s/\\/\\\\/'',-1,&&name&i) ';
391
- put ' ))))))))))))!!''"''; ';
379
+ put ' if findc(&&name&i,''"\''!!''0A0D09000E0F01021011''x) then do; ';
380
+ put ' &&name&i=''"''!!trim( ';
381
+ put ' prxchange(''s/"/\\"/'',-1, /* double quote */ ';
382
+ put ' prxchange(''s/\x0A/\n/'',-1, /* new line */ ';
383
+ put ' prxchange(''s/\x0D/\r/'',-1, /* carriage return */ ';
384
+ put ' prxchange(''s/\x09/\\t/'',-1, /* tab */ ';
385
+ put ' prxchange(''s/\x00/\\u0000/'',-1, /* NUL */ ';
386
+ put ' prxchange(''s/\x0E/\\u000E/'',-1, /* SS */ ';
387
+ put ' prxchange(''s/\x0F/\\u000F/'',-1, /* SF */ ';
388
+ put ' prxchange(''s/\x01/\\u0001/'',-1, /* SOH */ ';
389
+ put ' prxchange(''s/\x02/\\u0002/'',-1, /* STX */ ';
390
+ put ' prxchange(''s/\x10/\\u0010/'',-1, /* DLE */ ';
391
+ put ' prxchange(''s/\x11/\\u0011/'',-1, /* DC1 */ ';
392
+ put ' prxchange(''s/\\/\\\\/'',-1,&&name&i) ';
393
+ put ' ))))))))))))!!''"''; ';
394
+ put ' end; ';
395
+ put ' else &&name&i=quote(cats(&&name&i)); ';
392
396
  put ' %end; ';
393
397
  put ' %end; ';
394
398
  put ' run; ';