@sasjs/core 4.68.0 → 4.68.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/base/mf_wordsinstr1andstr2.sas +12 -17
- package/base/mf_wordsinstr1butnotstr2.sas +13 -18
- package/base/mp_jsonout.sas +2 -1
- package/meta/mm_createwebservice.sas +6 -2
- package/meta/mm_webout.sas +4 -1
- package/package.json +1 -1
- package/server/ms_createwebservice.sas +6 -2
- package/server/ms_webout.sas +4 -1
- package/viya/mv_createwebservice.sas +10 -3
- package/viya/mv_webout.sas +8 -2
|
@@ -3,9 +3,12 @@
|
|
|
3
3
|
@brief Returns words that are in both string 1 and string 2
|
|
4
4
|
@details Compares two space separated strings and returns the words that are
|
|
5
5
|
in both.
|
|
6
|
+
|
|
7
|
+
If either string is empty, nothing is returned.
|
|
8
|
+
|
|
6
9
|
Usage:
|
|
7
10
|
|
|
8
|
-
%put %
|
|
11
|
+
%put %mf_wordsinstr1andstr2(
|
|
9
12
|
Str1=blah sss blaaah brah bram boo
|
|
10
13
|
,Str2= blah blaaah brah ssss
|
|
11
14
|
);
|
|
@@ -23,31 +26,23 @@
|
|
|
23
26
|
|
|
24
27
|
**/
|
|
25
28
|
|
|
26
|
-
%macro
|
|
29
|
+
%macro mf_wordsinstr1andstr2(
|
|
27
30
|
Str1= /* string containing words to extract */
|
|
28
31
|
,Str2= /* used to compare with the extract string */
|
|
29
32
|
)/*/STORE SOURCE*/;
|
|
30
33
|
|
|
31
|
-
%local
|
|
34
|
+
%local count_extr i extr_word outvar;
|
|
32
35
|
%if %length(&str1)=0 or %length(&str2)=0 %then %do;
|
|
33
|
-
%put
|
|
34
|
-
%put compare string (str2) = &str2;
|
|
36
|
+
%put &sysmacroname: empty input string, nothing to compare;
|
|
35
37
|
%return;
|
|
36
38
|
%end;
|
|
37
|
-
%let count_base=%sysfunc(countw(&Str2));
|
|
38
39
|
%let count_extr=%sysfunc(countw(&Str1));
|
|
39
40
|
|
|
40
41
|
%do i=1 %to &count_extr;
|
|
41
42
|
%let extr_word=%scan(&Str1,&i,%str( ));
|
|
42
|
-
%
|
|
43
|
-
|
|
44
|
-
%let base_word=%scan(&Str2,&i2,%str( ));
|
|
45
|
-
%if &extr_word=&base_word %then %let match=1;
|
|
46
|
-
%end;
|
|
47
|
-
%if &match=1 %then %let outvar=&outvar &extr_word;
|
|
43
|
+
%if %sysfunc(indexw(%superq(str2),%superq(extr_word)))>0 %then
|
|
44
|
+
%let outvar=&outvar &extr_word;
|
|
48
45
|
%end;
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
%mend mf_wordsInStr1andStr2;
|
|
53
|
-
|
|
46
|
+
/* send out the result without any surrounding whitespace */
|
|
47
|
+
%do;&outvar%end;
|
|
48
|
+
%mend mf_wordsinstr1andstr2;
|
|
@@ -6,9 +6,12 @@
|
|
|
6
6
|
|
|
7
7
|
Note - case sensitive!
|
|
8
8
|
|
|
9
|
+
If str1 is empty, nothing is returned. If str2 is empty, all the words in
|
|
10
|
+
str1 are returned.
|
|
11
|
+
|
|
9
12
|
Usage:
|
|
10
13
|
|
|
11
|
-
%let x= %
|
|
14
|
+
%let x= %mf_wordsinstr1butnotstr2(
|
|
12
15
|
Str1=blah sss blaaah brah bram boo
|
|
13
16
|
,Str2= blah blaaah brah ssss
|
|
14
17
|
);
|
|
@@ -24,31 +27,23 @@
|
|
|
24
27
|
|
|
25
28
|
**/
|
|
26
29
|
|
|
27
|
-
%macro
|
|
30
|
+
%macro mf_wordsinstr1butnotstr2(
|
|
28
31
|
Str1= /* string containing words to extract */
|
|
29
32
|
,Str2= /* used to compare with the extract string */
|
|
30
33
|
)/*/STORE SOURCE*/;
|
|
31
34
|
|
|
32
|
-
%local
|
|
33
|
-
%if %length(&str1)=0
|
|
34
|
-
%put
|
|
35
|
-
%put compare string (str2) = &str2;
|
|
35
|
+
%local count_extr i extr_word outvar;
|
|
36
|
+
%if %length(&str1)=0 %then %do;
|
|
37
|
+
%put &sysmacroname: str1 is empty, nothing to compare;
|
|
36
38
|
%return;
|
|
37
39
|
%end;
|
|
38
|
-
%let count_base=%sysfunc(countw(&Str2));
|
|
39
40
|
%let count_extr=%sysfunc(countw(&Str1));
|
|
40
41
|
|
|
41
42
|
%do i=1 %to &count_extr;
|
|
42
43
|
%let extr_word=%scan(&Str1,&i,%str( ));
|
|
43
|
-
%
|
|
44
|
-
|
|
45
|
-
%let base_word=%scan(&Str2,&i2,%str( ));
|
|
46
|
-
%if &extr_word=&base_word %then %let match=1;
|
|
47
|
-
%end;
|
|
48
|
-
%if &match=0 %then %let outvar=&outvar &extr_word;
|
|
44
|
+
%if %sysfunc(indexw(%superq(str2),%superq(extr_word)))=0 %then
|
|
45
|
+
%let outvar=&outvar &extr_word;
|
|
49
46
|
%end;
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
%mend mf_wordsInStr1ButNotStr2;
|
|
54
|
-
|
|
47
|
+
/* send out the result without any surrounding whitespace */
|
|
48
|
+
%do;&outvar%end;
|
|
49
|
+
%mend mf_wordsinstr1butnotstr2;
|
package/base/mp_jsonout.sas
CHANGED
|
@@ -355,7 +355,8 @@ data _null_;
|
|
|
355
355
|
put ' prxchange(''s/\\/\\\\/'',-1,&&name&i) ';
|
|
356
356
|
put ' )))))))))))))!!''"''; ';
|
|
357
357
|
put ' end; ';
|
|
358
|
-
put '
|
|
358
|
+
put ' /* trim (not cats) so leading blanks are retained */ ';
|
|
359
|
+
put ' else &&name&i=''"''!!trim(&&name&i)!!''"''; ';
|
|
359
360
|
put ' %end; ';
|
|
360
361
|
put ' %end; ';
|
|
361
362
|
put ' run; ';
|
|
@@ -474,7 +475,10 @@ data _null_;
|
|
|
474
475
|
put ' data _null_; ';
|
|
475
476
|
put ' infile &&_webin_fileref&i termstr=crlf; ';
|
|
476
477
|
put ' input; ';
|
|
477
|
-
put '
|
|
478
|
+
put ' /* a plain $ informat strips leading blanks - use $char instead */ ';
|
|
479
|
+
put ' call symputx(''input_statement'' ';
|
|
480
|
+
put ' ,prxchange(''s/:\$(?=[0-9 ])/:\$char/i'',-1,_infile_) ';
|
|
481
|
+
put ' ); ';
|
|
478
482
|
put ' putlog "&&_webin_name&i input statement: " _infile_; ';
|
|
479
483
|
put ' stop; ';
|
|
480
484
|
put ' data &&_webin_name&i; ';
|
package/meta/mm_webout.sas
CHANGED
|
@@ -77,7 +77,10 @@
|
|
|
77
77
|
data _null_;
|
|
78
78
|
infile &&_webin_fileref&i termstr=crlf;
|
|
79
79
|
input;
|
|
80
|
-
|
|
80
|
+
/* a plain $ informat strips leading blanks - use $char instead */
|
|
81
|
+
call symputx('input_statement'
|
|
82
|
+
,prxchange('s/:\$(?=[0-9 ])/:\$char/i',-1,_infile_)
|
|
83
|
+
);
|
|
81
84
|
putlog "&&_webin_name&i input statement: " _infile_;
|
|
82
85
|
stop;
|
|
83
86
|
data &&_webin_name&i;
|
package/package.json
CHANGED
|
@@ -355,7 +355,8 @@ data _null_;
|
|
|
355
355
|
put ' prxchange(''s/\\/\\\\/'',-1,&&name&i) ';
|
|
356
356
|
put ' )))))))))))))!!''"''; ';
|
|
357
357
|
put ' end; ';
|
|
358
|
-
put '
|
|
358
|
+
put ' /* trim (not cats) so leading blanks are retained */ ';
|
|
359
|
+
put ' else &&name&i=''"''!!trim(&&name&i)!!''"''; ';
|
|
359
360
|
put ' %end; ';
|
|
360
361
|
put ' %end; ';
|
|
361
362
|
put ' run; ';
|
|
@@ -472,7 +473,10 @@ data _null_;
|
|
|
472
473
|
put ' data _null_; ';
|
|
473
474
|
put ' infile &&_webin_fileref&i termstr=crlf lrecl=32767; ';
|
|
474
475
|
put ' input; ';
|
|
475
|
-
put '
|
|
476
|
+
put ' /* a plain $ informat strips leading blanks - use $char instead */ ';
|
|
477
|
+
put ' call symputx(''input_statement'' ';
|
|
478
|
+
put ' ,prxchange(''s/:\$(?=[0-9 ])/:\$char/i'',-1,_infile_) ';
|
|
479
|
+
put ' ); ';
|
|
476
480
|
put ' putlog "&&_webin_name&i input statement: " _infile_; ';
|
|
477
481
|
put ' stop; ';
|
|
478
482
|
put ' data &&_webin_name&i; ';
|
package/server/ms_webout.sas
CHANGED
|
@@ -74,7 +74,10 @@
|
|
|
74
74
|
data _null_;
|
|
75
75
|
infile &&_webin_fileref&i termstr=crlf lrecl=32767;
|
|
76
76
|
input;
|
|
77
|
-
|
|
77
|
+
/* a plain $ informat strips leading blanks - use $char instead */
|
|
78
|
+
call symputx('input_statement'
|
|
79
|
+
,prxchange('s/:\$(?=[0-9 ])/:\$char/i',-1,_infile_)
|
|
80
|
+
);
|
|
78
81
|
putlog "&&_webin_name&i input statement: " _infile_;
|
|
79
82
|
stop;
|
|
80
83
|
data &&_webin_name&i;
|
|
@@ -497,7 +497,8 @@ data _null_;
|
|
|
497
497
|
put ' prxchange(''s/\\/\\\\/'',-1,&&name&i) ';
|
|
498
498
|
put ' )))))))))))))!!''"''; ';
|
|
499
499
|
put ' end; ';
|
|
500
|
-
put '
|
|
500
|
+
put ' /* trim (not cats) so leading blanks are retained */ ';
|
|
501
|
+
put ' else &&name&i=''"''!!trim(&&name&i)!!''"''; ';
|
|
501
502
|
put ' %end; ';
|
|
502
503
|
put ' %end; ';
|
|
503
504
|
put ' run; ';
|
|
@@ -643,7 +644,10 @@ data _null_;
|
|
|
643
644
|
put ' data _null_; ';
|
|
644
645
|
put ' infile "%sysfunc(pathname(work))/&table..csv" termstr=crlf ; ';
|
|
645
646
|
put ' input; ';
|
|
646
|
-
put '
|
|
647
|
+
put ' /* a plain $ informat strips leading blanks - use $char instead */ ';
|
|
648
|
+
put ' if _n_=1 then call symputx(''input_statement'' ';
|
|
649
|
+
put ' ,prxchange(''s/:\$(?=[0-9 ])/:\$char/i'',-1,_infile_) ';
|
|
650
|
+
put ' ); ';
|
|
647
651
|
put ' list; ';
|
|
648
652
|
put ' data work.&table; ';
|
|
649
653
|
put ' infile "%sysfunc(pathname(work))/&table..csv" firstobs=2 dsd ';
|
|
@@ -663,7 +667,10 @@ data _null_;
|
|
|
663
667
|
put ' data _null_; ';
|
|
664
668
|
put ' infile indata termstr=crlf lrecl=32767; ';
|
|
665
669
|
put ' input; ';
|
|
666
|
-
put '
|
|
670
|
+
put ' /* a plain $ informat strips leading blanks - use $char instead */ ';
|
|
671
|
+
put ' if _n_=1 then call symputx(''input_statement'' ';
|
|
672
|
+
put ' ,prxchange(''s/:\$(?=[0-9 ])/:\$char/i'',-1,_infile_) ';
|
|
673
|
+
put ' ); ';
|
|
667
674
|
put ' %if %str(&_debug) ge 128 %then %do; ';
|
|
668
675
|
put ' if _n_<20 then putlog _infile_; ';
|
|
669
676
|
put ' else stop; ';
|
package/viya/mv_webout.sas
CHANGED
|
@@ -104,7 +104,10 @@
|
|
|
104
104
|
data _null_;
|
|
105
105
|
infile "%sysfunc(pathname(work))/&table..csv" termstr=crlf ;
|
|
106
106
|
input;
|
|
107
|
-
|
|
107
|
+
/* a plain $ informat strips leading blanks - use $char instead */
|
|
108
|
+
if _n_=1 then call symputx('input_statement'
|
|
109
|
+
,prxchange('s/:\$(?=[0-9 ])/:\$char/i',-1,_infile_)
|
|
110
|
+
);
|
|
108
111
|
list;
|
|
109
112
|
data work.&table;
|
|
110
113
|
infile "%sysfunc(pathname(work))/&table..csv" firstobs=2 dsd
|
|
@@ -124,7 +127,10 @@
|
|
|
124
127
|
data _null_;
|
|
125
128
|
infile indata termstr=crlf lrecl=32767;
|
|
126
129
|
input;
|
|
127
|
-
|
|
130
|
+
/* a plain $ informat strips leading blanks - use $char instead */
|
|
131
|
+
if _n_=1 then call symputx('input_statement'
|
|
132
|
+
,prxchange('s/:\$(?=[0-9 ])/:\$char/i',-1,_infile_)
|
|
133
|
+
);
|
|
128
134
|
%if %str(&_debug) ge 128 %then %do;
|
|
129
135
|
if _n_<20 then putlog _infile_;
|
|
130
136
|
else stop;
|