mirror of
https://github.com/sasjs/core.git
synced 2025-12-15 08:14:34 +00:00
Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6667b91ced | ||
|
|
bce56d8105 | ||
|
|
2ec440b321 | ||
|
|
3d2ad531cf | ||
|
|
09136cfdbb | ||
|
|
1e72f13f2d |
124
all.sas
124
all.sas
@@ -1805,6 +1805,60 @@ Usage:
|
|||||||
%exit_success:
|
%exit_success:
|
||||||
|
|
||||||
%mend mf_verifymacvars;
|
%mend mf_verifymacvars;
|
||||||
|
/**
|
||||||
|
@file
|
||||||
|
@brief Returns words that are in both string 1 and string 2
|
||||||
|
@details Compares two space separated strings and returns the words that are
|
||||||
|
in both.
|
||||||
|
Usage:
|
||||||
|
|
||||||
|
%put %mf_wordsInStr1andStr2(
|
||||||
|
Str1=blah sss blaaah brah bram boo
|
||||||
|
,Str2= blah blaaah brah ssss
|
||||||
|
);
|
||||||
|
|
||||||
|
returns:
|
||||||
|
> blah blaaah brah
|
||||||
|
|
||||||
|
@param str1= string containing words to extract
|
||||||
|
@param str2= used to compare with the extract string
|
||||||
|
|
||||||
|
@warning CASE SENSITIVE!
|
||||||
|
|
||||||
|
@version 9.2
|
||||||
|
@author Allan Bowe
|
||||||
|
|
||||||
|
**/
|
||||||
|
|
||||||
|
%macro mf_wordsInStr1andStr2(
|
||||||
|
Str1= /* string containing words to extract */
|
||||||
|
,Str2= /* used to compare with the extract string */
|
||||||
|
)/*/STORE SOURCE*/;
|
||||||
|
|
||||||
|
%local count_base count_extr i i2 extr_word base_word match outvar;
|
||||||
|
%if %length(&str1)=0 or %length(&str2)=0 %then %do;
|
||||||
|
%put %str(WARN)ING: empty string provided!;
|
||||||
|
%put base string (str1)= &str1;
|
||||||
|
%put compare string (str2) = &str2;
|
||||||
|
%return;
|
||||||
|
%end;
|
||||||
|
%let count_base=%sysfunc(countw(&Str2));
|
||||||
|
%let count_extr=%sysfunc(countw(&Str1));
|
||||||
|
|
||||||
|
%do i=1 %to &count_extr;
|
||||||
|
%let extr_word=%scan(&Str1,&i,%str( ));
|
||||||
|
%let match=0;
|
||||||
|
%do i2=1 %to &count_base;
|
||||||
|
%let base_word=%scan(&Str2,&i2,%str( ));
|
||||||
|
%if &extr_word=&base_word %then %let match=1;
|
||||||
|
%end;
|
||||||
|
%if &match=1 %then %let outvar=&outvar &extr_word;
|
||||||
|
%end;
|
||||||
|
|
||||||
|
&outvar
|
||||||
|
|
||||||
|
%mend mf_wordsInStr1andStr2;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@file
|
@file
|
||||||
@brief Returns words that are in string 1 but not in string 2
|
@brief Returns words that are in string 1 but not in string 2
|
||||||
@@ -6901,13 +6955,13 @@ filename &tempref clear;
|
|||||||
%put output location=&jref;
|
%put output location=&jref;
|
||||||
%if &action=OPEN %then %do;
|
%if &action=OPEN %then %do;
|
||||||
options nobomfile;
|
options nobomfile;
|
||||||
data _null_;file &jref encoding='utf-8';
|
data _null_;file &jref encoding='utf-8' ;
|
||||||
put '{"PROCESSED_DTTM" : "' "%sysfunc(datetime(),E8601DT26.6)" '"';
|
put '{"PROCESSED_DTTM" : "' "%sysfunc(datetime(),E8601DT26.6)" '"';
|
||||||
run;
|
run;
|
||||||
%end;
|
%end;
|
||||||
%else %if (&action=ARR or &action=OBJ) %then %do;
|
%else %if (&action=ARR or &action=OBJ) %then %do;
|
||||||
options validvarname=upcase;
|
options validvarname=upcase;
|
||||||
data _null_;file &jref mod encoding='utf-8';
|
data _null_;file &jref mod encoding='utf-8' ;
|
||||||
put ", ""%lowcase(%sysfunc(coalescec(&dslabel,&ds)))"":";
|
put ", ""%lowcase(%sysfunc(coalescec(&dslabel,&ds)))"":";
|
||||||
|
|
||||||
%if &engine=PROCJSON %then %do;
|
%if &engine=PROCJSON %then %do;
|
||||||
@@ -6986,7 +7040,7 @@ filename &tempref clear;
|
|||||||
run;
|
run;
|
||||||
%let ds=&fmtds;
|
%let ds=&fmtds;
|
||||||
%end; /* &fmt=Y */
|
%end; /* &fmt=Y */
|
||||||
data _null_;file &jref mod encoding='utf-8';
|
data _null_;file &jref mod encoding='utf-8' ;
|
||||||
put "["; call symputx('cols',0,'l');
|
put "["; call symputx('cols',0,'l');
|
||||||
proc sort
|
proc sort
|
||||||
data=sashelp.vcolumn(where=(libname='WORK' & memname="%upcase(&ds)"))
|
data=sashelp.vcolumn(where=(libname='WORK' & memname="%upcase(&ds)"))
|
||||||
@@ -7031,7 +7085,7 @@ filename &tempref clear;
|
|||||||
/* write to temp loc to avoid _webout truncation
|
/* write to temp loc to avoid _webout truncation
|
||||||
- https://support.sas.com/kb/49/325.html */
|
- https://support.sas.com/kb/49/325.html */
|
||||||
filename _sjs temp lrecl=131068 encoding='utf-8';
|
filename _sjs temp lrecl=131068 encoding='utf-8';
|
||||||
data _null_; file _sjs lrecl=131068 encoding='utf-8' mod;
|
data _null_; file _sjs lrecl=131068 encoding='utf-8' mod ;
|
||||||
set &tempds;
|
set &tempds;
|
||||||
if _n_>1 then put "," @; put
|
if _n_>1 then put "," @; put
|
||||||
%if &action=ARR %then "[" ; %else "{" ;
|
%if &action=ARR %then "[" ; %else "{" ;
|
||||||
@@ -7058,14 +7112,14 @@ filename &tempref clear;
|
|||||||
rc = fclose(fileid);
|
rc = fclose(fileid);
|
||||||
run;
|
run;
|
||||||
filename _sjs clear;
|
filename _sjs clear;
|
||||||
data _null_; file &jref mod encoding='utf-8';
|
data _null_; file &jref mod encoding='utf-8' ;
|
||||||
put "]";
|
put "]";
|
||||||
run;
|
run;
|
||||||
%end;
|
%end;
|
||||||
%end;
|
%end;
|
||||||
|
|
||||||
%else %if &action=CLOSE %then %do;
|
%else %if &action=CLOSE %then %do;
|
||||||
data _null_;file &jref encoding='utf-8' mod;
|
data _null_;file &jref encoding='utf-8' mod ;
|
||||||
put "}";
|
put "}";
|
||||||
run;
|
run;
|
||||||
%end;
|
%end;
|
||||||
@@ -7909,13 +7963,15 @@ options obs=max replace nosyntaxcheck;
|
|||||||
@brief Reset an option to original value
|
@brief Reset an option to original value
|
||||||
@details Inspired by the SAS Jedi -
|
@details Inspired by the SAS Jedi -
|
||||||
https://blogs.sas.com/content/sastraining/2012/08/14/jedi-sas-tricks-reset-sas-system-options
|
https://blogs.sas.com/content/sastraining/2012/08/14/jedi-sas-tricks-reset-sas-system-options
|
||||||
Called as follows:
|
|
||||||
|
|
||||||
options obs=30;
|
Called as follows:
|
||||||
%mp_resetoption(OBS)
|
|
||||||
|
options obs=30 ps=max;
|
||||||
|
%mp_resetoption(OBS)
|
||||||
|
%mp_resetoption(PS)
|
||||||
|
|
||||||
|
|
||||||
@param option the option to reset
|
@param [in] option the option to reset
|
||||||
|
|
||||||
@version 9.2
|
@version 9.2
|
||||||
@author Allan Bowe
|
@author Allan Bowe
|
||||||
@@ -8284,9 +8340,7 @@ select distinct memname into: table_list separated by ' '
|
|||||||
|
|
||||||
This macro will only work for BASE (V9) engine libraries. It works by
|
This macro will only work for BASE (V9) engine libraries. It works by
|
||||||
creating a copy of the dataset (without data, WITH constraints) in the same
|
creating a copy of the dataset (without data, WITH constraints) in the same
|
||||||
library, appending a sorted view into it, and finally - renaming it. By
|
library, appending a sorted view into it, and finally - renaming it.
|
||||||
default, COMPRESS=CHAR and REUSE=YES will be applied, this behaviour can
|
|
||||||
be adjusted using the `dsoptions=` parameter.
|
|
||||||
|
|
||||||
Example usage:
|
Example usage:
|
||||||
|
|
||||||
@@ -8314,7 +8368,6 @@ select distinct memname into: table_list separated by ' '
|
|||||||
|
|
||||||
@version 9.2
|
@version 9.2
|
||||||
@author Allan Bowe
|
@author Allan Bowe
|
||||||
@source https://github.com/sasjs/core
|
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
@@ -11711,13 +11764,13 @@ data _null_;
|
|||||||
put '%put output location=&jref; ';
|
put '%put output location=&jref; ';
|
||||||
put '%if &action=OPEN %then %do; ';
|
put '%if &action=OPEN %then %do; ';
|
||||||
put ' options nobomfile; ';
|
put ' options nobomfile; ';
|
||||||
put ' data _null_;file &jref encoding=''utf-8''; ';
|
put ' data _null_;file &jref encoding=''utf-8'' ; ';
|
||||||
put ' put ''{"PROCESSED_DTTM" : "'' "%sysfunc(datetime(),E8601DT26.6)" ''"''; ';
|
put ' put ''{"PROCESSED_DTTM" : "'' "%sysfunc(datetime(),E8601DT26.6)" ''"''; ';
|
||||||
put ' run; ';
|
put ' run; ';
|
||||||
put '%end; ';
|
put '%end; ';
|
||||||
put '%else %if (&action=ARR or &action=OBJ) %then %do; ';
|
put '%else %if (&action=ARR or &action=OBJ) %then %do; ';
|
||||||
put ' options validvarname=upcase; ';
|
put ' options validvarname=upcase; ';
|
||||||
put ' data _null_;file &jref mod encoding=''utf-8''; ';
|
put ' data _null_;file &jref mod encoding=''utf-8'' ; ';
|
||||||
put ' put ", ""%lowcase(%sysfunc(coalescec(&dslabel,&ds)))"":"; ';
|
put ' put ", ""%lowcase(%sysfunc(coalescec(&dslabel,&ds)))"":"; ';
|
||||||
put ' ';
|
put ' ';
|
||||||
put ' %if &engine=PROCJSON %then %do; ';
|
put ' %if &engine=PROCJSON %then %do; ';
|
||||||
@@ -11796,7 +11849,7 @@ data _null_;
|
|||||||
put ' run; ';
|
put ' run; ';
|
||||||
put ' %let ds=&fmtds; ';
|
put ' %let ds=&fmtds; ';
|
||||||
put ' %end; /* &fmt=Y */ ';
|
put ' %end; /* &fmt=Y */ ';
|
||||||
put ' data _null_;file &jref mod encoding=''utf-8''; ';
|
put ' data _null_;file &jref mod encoding=''utf-8'' ; ';
|
||||||
put ' put "["; call symputx(''cols'',0,''l''); ';
|
put ' put "["; call symputx(''cols'',0,''l''); ';
|
||||||
put ' proc sort ';
|
put ' proc sort ';
|
||||||
put ' data=sashelp.vcolumn(where=(libname=''WORK'' & memname="%upcase(&ds)")) ';
|
put ' data=sashelp.vcolumn(where=(libname=''WORK'' & memname="%upcase(&ds)")) ';
|
||||||
@@ -11841,7 +11894,7 @@ data _null_;
|
|||||||
put ' /* write to temp loc to avoid _webout truncation ';
|
put ' /* write to temp loc to avoid _webout truncation ';
|
||||||
put ' - https://support.sas.com/kb/49/325.html */ ';
|
put ' - https://support.sas.com/kb/49/325.html */ ';
|
||||||
put ' filename _sjs temp lrecl=131068 encoding=''utf-8''; ';
|
put ' filename _sjs temp lrecl=131068 encoding=''utf-8''; ';
|
||||||
put ' data _null_; file _sjs lrecl=131068 encoding=''utf-8'' mod; ';
|
put ' data _null_; file _sjs lrecl=131068 encoding=''utf-8'' mod ; ';
|
||||||
put ' set &tempds; ';
|
put ' set &tempds; ';
|
||||||
put ' if _n_>1 then put "," @; put ';
|
put ' if _n_>1 then put "," @; put ';
|
||||||
put ' %if &action=ARR %then "[" ; %else "{" ; ';
|
put ' %if &action=ARR %then "[" ; %else "{" ; ';
|
||||||
@@ -11868,14 +11921,14 @@ data _null_;
|
|||||||
put ' rc = fclose(fileid); ';
|
put ' rc = fclose(fileid); ';
|
||||||
put ' run; ';
|
put ' run; ';
|
||||||
put ' filename _sjs clear; ';
|
put ' filename _sjs clear; ';
|
||||||
put ' data _null_; file &jref mod encoding=''utf-8''; ';
|
put ' data _null_; file &jref mod encoding=''utf-8'' ; ';
|
||||||
put ' put "]"; ';
|
put ' put "]"; ';
|
||||||
put ' run; ';
|
put ' run; ';
|
||||||
put ' %end; ';
|
put ' %end; ';
|
||||||
put '%end; ';
|
put '%end; ';
|
||||||
put ' ';
|
put ' ';
|
||||||
put '%else %if &action=CLOSE %then %do; ';
|
put '%else %if &action=CLOSE %then %do; ';
|
||||||
put ' data _null_;file &jref encoding=''utf-8'' mod; ';
|
put ' data _null_;file &jref encoding=''utf-8'' mod ; ';
|
||||||
put ' put "}"; ';
|
put ' put "}"; ';
|
||||||
put ' run; ';
|
put ' run; ';
|
||||||
put '%end; ';
|
put '%end; ';
|
||||||
@@ -15723,7 +15776,7 @@ run;
|
|||||||
OPTIONS NOBOMFILE;
|
OPTIONS NOBOMFILE;
|
||||||
|
|
||||||
/* setup json */
|
/* setup json */
|
||||||
data _null_;file &fref encoding='utf-8';
|
data _null_;file &fref encoding='utf-8' termstr=lf;
|
||||||
%if %str(&_debug) ge 131 %then %do;
|
%if %str(&_debug) ge 131 %then %do;
|
||||||
put '>>weboutBEGIN<<';
|
put '>>weboutBEGIN<<';
|
||||||
%end;
|
%end;
|
||||||
@@ -15752,14 +15805,14 @@ run;
|
|||||||
i+1;
|
i+1;
|
||||||
call symputx('wt'!!left(i),name,'l');
|
call symputx('wt'!!left(i),name,'l');
|
||||||
call symputx('wtcnt',i,'l');
|
call symputx('wtcnt',i,'l');
|
||||||
data _null_; file &fref mod encoding='utf-8';
|
data _null_; file &fref mod encoding='utf-8' termstr=lf;
|
||||||
put ",""WORK"":{";
|
put ",""WORK"":{";
|
||||||
%do i=1 %to &wtcnt;
|
%do i=1 %to &wtcnt;
|
||||||
%let wt=&&wt&i;
|
%let wt=&&wt&i;
|
||||||
proc contents noprint data=&wt
|
proc contents noprint data=&wt
|
||||||
out=_data_ (keep=name type length format:);
|
out=_data_ (keep=name type length format:);
|
||||||
run;%let tempds=%scan(&syslast,2,.);
|
run;%let tempds=%scan(&syslast,2,.);
|
||||||
data _null_; file &fref mod encoding='utf-8';
|
data _null_; file &fref mod encoding='utf-8' termstr=lf;
|
||||||
dsid=open("WORK.&wt",'is');
|
dsid=open("WORK.&wt",'is');
|
||||||
nlobs=attrn(dsid,'NLOBS');
|
nlobs=attrn(dsid,'NLOBS');
|
||||||
nvars=attrn(dsid,'NVARS');
|
nvars=attrn(dsid,'NVARS');
|
||||||
@@ -15770,15 +15823,15 @@ run;
|
|||||||
put ',"nvars":' nvars;
|
put ',"nvars":' nvars;
|
||||||
%mp_jsonout(OBJ,&tempds,jref=&fref,dslabel=colattrs,engine=DATASTEP)
|
%mp_jsonout(OBJ,&tempds,jref=&fref,dslabel=colattrs,engine=DATASTEP)
|
||||||
%mp_jsonout(OBJ,&wt,jref=&fref,dslabel=first10rows,engine=DATASTEP)
|
%mp_jsonout(OBJ,&wt,jref=&fref,dslabel=first10rows,engine=DATASTEP)
|
||||||
data _null_; file &fref mod encoding='utf-8';
|
data _null_; file &fref mod encoding='utf-8' termstr=lf;
|
||||||
put "}";
|
put "}";
|
||||||
%end;
|
%end;
|
||||||
data _null_; file &fref mod encoding='utf-8';
|
data _null_; file &fref mod encoding='utf-8' termstr=lf termstr=lf;
|
||||||
put "}";
|
put "}";
|
||||||
run;
|
run;
|
||||||
%end;
|
%end;
|
||||||
/* close off json */
|
/* close off json */
|
||||||
data _null_;file &fref mod encoding='utf-8';
|
data _null_;file &fref mod encoding='utf-8' termstr=lf;
|
||||||
_PROGRAM=quote(trim(resolve(symget('_PROGRAM'))));
|
_PROGRAM=quote(trim(resolve(symget('_PROGRAM'))));
|
||||||
put ",""SYSUSERID"" : ""&sysuserid"" ";
|
put ",""SYSUSERID"" : ""&sysuserid"" ";
|
||||||
put ",""MF_GETUSER"" : ""%mf_getuser()"" ";
|
put ",""MF_GETUSER"" : ""%mf_getuser()"" ";
|
||||||
@@ -15791,7 +15844,9 @@ run;
|
|||||||
put ",""SYSHOSTNAME"" : ""&syshostname"" ";
|
put ",""SYSHOSTNAME"" : ""&syshostname"" ";
|
||||||
put ",""SYSPROCESSID"" : ""&SYSPROCESSID"" ";
|
put ",""SYSPROCESSID"" : ""&SYSPROCESSID"" ";
|
||||||
put ",""SYSPROCESSMODE"" : ""&SYSPROCESSMODE"" ";
|
put ",""SYSPROCESSMODE"" : ""&SYSPROCESSMODE"" ";
|
||||||
put ",""SYSPROCESSNAME"" : ""&SYSPROCESSNAME"" ";
|
length SYSPROCESSNAME $512;
|
||||||
|
SYSPROCESSNAME=quote(urlencode(cats(SYSPROCESSNAME)));
|
||||||
|
put ",""SYSPROCESSNAME"" : " SYSPROCESSNAME;
|
||||||
put ",""SYSJOBID"" : ""&sysjobid"" ";
|
put ",""SYSJOBID"" : ""&sysjobid"" ";
|
||||||
put ",""SYSSCPL"" : ""&sysscpl"" ";
|
put ",""SYSSCPL"" : ""&sysscpl"" ";
|
||||||
put ",""SYSSITE"" : ""&syssite"" ";
|
put ",""SYSSITE"" : ""&syssite"" ";
|
||||||
@@ -15800,7 +15855,8 @@ run;
|
|||||||
put ',"SYSVLONG" : ' sysvlong;
|
put ',"SYSVLONG" : ' sysvlong;
|
||||||
put ",""SYSWARNINGTEXT"" : ""&syswarningtext"" ";
|
put ",""SYSWARNINGTEXT"" : ""&syswarningtext"" ";
|
||||||
put ',"END_DTTM" : "' "%sysfunc(datetime(),datetime20.3)" '" ';
|
put ',"END_DTTM" : "' "%sysfunc(datetime(),datetime20.3)" '" ';
|
||||||
autoexec=quote(trim(getoption('autoexec')));
|
length autoexec $512;
|
||||||
|
autoexec=quote(urlencode(trim(getoption('autoexec'))));
|
||||||
put ',"AUTOEXEC" : ' autoexec;
|
put ',"AUTOEXEC" : ' autoexec;
|
||||||
memsize="%sysfunc(INPUTN(%sysfunc(getoption(memsize)), best.),sizekmg.)";
|
memsize="%sysfunc(INPUTN(%sysfunc(getoption(memsize)), best.),sizekmg.)";
|
||||||
memsize=quote(cats(memsize));
|
memsize=quote(cats(memsize));
|
||||||
@@ -16792,13 +16848,13 @@ data _null_;
|
|||||||
put '%put output location=&jref; ';
|
put '%put output location=&jref; ';
|
||||||
put '%if &action=OPEN %then %do; ';
|
put '%if &action=OPEN %then %do; ';
|
||||||
put ' options nobomfile; ';
|
put ' options nobomfile; ';
|
||||||
put ' data _null_;file &jref encoding=''utf-8''; ';
|
put ' data _null_;file &jref encoding=''utf-8'' ; ';
|
||||||
put ' put ''{"PROCESSED_DTTM" : "'' "%sysfunc(datetime(),E8601DT26.6)" ''"''; ';
|
put ' put ''{"PROCESSED_DTTM" : "'' "%sysfunc(datetime(),E8601DT26.6)" ''"''; ';
|
||||||
put ' run; ';
|
put ' run; ';
|
||||||
put '%end; ';
|
put '%end; ';
|
||||||
put '%else %if (&action=ARR or &action=OBJ) %then %do; ';
|
put '%else %if (&action=ARR or &action=OBJ) %then %do; ';
|
||||||
put ' options validvarname=upcase; ';
|
put ' options validvarname=upcase; ';
|
||||||
put ' data _null_;file &jref mod encoding=''utf-8''; ';
|
put ' data _null_;file &jref mod encoding=''utf-8'' ; ';
|
||||||
put ' put ", ""%lowcase(%sysfunc(coalescec(&dslabel,&ds)))"":"; ';
|
put ' put ", ""%lowcase(%sysfunc(coalescec(&dslabel,&ds)))"":"; ';
|
||||||
put ' ';
|
put ' ';
|
||||||
put ' %if &engine=PROCJSON %then %do; ';
|
put ' %if &engine=PROCJSON %then %do; ';
|
||||||
@@ -16877,7 +16933,7 @@ data _null_;
|
|||||||
put ' run; ';
|
put ' run; ';
|
||||||
put ' %let ds=&fmtds; ';
|
put ' %let ds=&fmtds; ';
|
||||||
put ' %end; /* &fmt=Y */ ';
|
put ' %end; /* &fmt=Y */ ';
|
||||||
put ' data _null_;file &jref mod encoding=''utf-8''; ';
|
put ' data _null_;file &jref mod encoding=''utf-8'' ; ';
|
||||||
put ' put "["; call symputx(''cols'',0,''l''); ';
|
put ' put "["; call symputx(''cols'',0,''l''); ';
|
||||||
put ' proc sort ';
|
put ' proc sort ';
|
||||||
put ' data=sashelp.vcolumn(where=(libname=''WORK'' & memname="%upcase(&ds)")) ';
|
put ' data=sashelp.vcolumn(where=(libname=''WORK'' & memname="%upcase(&ds)")) ';
|
||||||
@@ -16922,7 +16978,7 @@ data _null_;
|
|||||||
put ' /* write to temp loc to avoid _webout truncation ';
|
put ' /* write to temp loc to avoid _webout truncation ';
|
||||||
put ' - https://support.sas.com/kb/49/325.html */ ';
|
put ' - https://support.sas.com/kb/49/325.html */ ';
|
||||||
put ' filename _sjs temp lrecl=131068 encoding=''utf-8''; ';
|
put ' filename _sjs temp lrecl=131068 encoding=''utf-8''; ';
|
||||||
put ' data _null_; file _sjs lrecl=131068 encoding=''utf-8'' mod; ';
|
put ' data _null_; file _sjs lrecl=131068 encoding=''utf-8'' mod ; ';
|
||||||
put ' set &tempds; ';
|
put ' set &tempds; ';
|
||||||
put ' if _n_>1 then put "," @; put ';
|
put ' if _n_>1 then put "," @; put ';
|
||||||
put ' %if &action=ARR %then "[" ; %else "{" ; ';
|
put ' %if &action=ARR %then "[" ; %else "{" ; ';
|
||||||
@@ -16949,14 +17005,14 @@ data _null_;
|
|||||||
put ' rc = fclose(fileid); ';
|
put ' rc = fclose(fileid); ';
|
||||||
put ' run; ';
|
put ' run; ';
|
||||||
put ' filename _sjs clear; ';
|
put ' filename _sjs clear; ';
|
||||||
put ' data _null_; file &jref mod encoding=''utf-8''; ';
|
put ' data _null_; file &jref mod encoding=''utf-8'' ; ';
|
||||||
put ' put "]"; ';
|
put ' put "]"; ';
|
||||||
put ' run; ';
|
put ' run; ';
|
||||||
put ' %end; ';
|
put ' %end; ';
|
||||||
put '%end; ';
|
put '%end; ';
|
||||||
put ' ';
|
put ' ';
|
||||||
put '%else %if &action=CLOSE %then %do; ';
|
put '%else %if &action=CLOSE %then %do; ';
|
||||||
put ' data _null_;file &jref encoding=''utf-8'' mod; ';
|
put ' data _null_;file &jref encoding=''utf-8'' mod ; ';
|
||||||
put ' put "}"; ';
|
put ' put "}"; ';
|
||||||
put ' run; ';
|
put ' run; ';
|
||||||
put '%end; ';
|
put '%end; ';
|
||||||
|
|||||||
54
base/mf_wordsinstr1andstr2.sas
Normal file
54
base/mf_wordsinstr1andstr2.sas
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
/**
|
||||||
|
@file
|
||||||
|
@brief Returns words that are in both string 1 and string 2
|
||||||
|
@details Compares two space separated strings and returns the words that are
|
||||||
|
in both.
|
||||||
|
Usage:
|
||||||
|
|
||||||
|
%put %mf_wordsInStr1andStr2(
|
||||||
|
Str1=blah sss blaaah brah bram boo
|
||||||
|
,Str2= blah blaaah brah ssss
|
||||||
|
);
|
||||||
|
|
||||||
|
returns:
|
||||||
|
> blah blaaah brah
|
||||||
|
|
||||||
|
@param str1= string containing words to extract
|
||||||
|
@param str2= used to compare with the extract string
|
||||||
|
|
||||||
|
@warning CASE SENSITIVE!
|
||||||
|
|
||||||
|
@version 9.2
|
||||||
|
@author Allan Bowe
|
||||||
|
|
||||||
|
**/
|
||||||
|
|
||||||
|
%macro mf_wordsInStr1andStr2(
|
||||||
|
Str1= /* string containing words to extract */
|
||||||
|
,Str2= /* used to compare with the extract string */
|
||||||
|
)/*/STORE SOURCE*/;
|
||||||
|
|
||||||
|
%local count_base count_extr i i2 extr_word base_word match outvar;
|
||||||
|
%if %length(&str1)=0 or %length(&str2)=0 %then %do;
|
||||||
|
%put %str(WARN)ING: empty string provided!;
|
||||||
|
%put base string (str1)= &str1;
|
||||||
|
%put compare string (str2) = &str2;
|
||||||
|
%return;
|
||||||
|
%end;
|
||||||
|
%let count_base=%sysfunc(countw(&Str2));
|
||||||
|
%let count_extr=%sysfunc(countw(&Str1));
|
||||||
|
|
||||||
|
%do i=1 %to &count_extr;
|
||||||
|
%let extr_word=%scan(&Str1,&i,%str( ));
|
||||||
|
%let match=0;
|
||||||
|
%do i2=1 %to &count_base;
|
||||||
|
%let base_word=%scan(&Str2,&i2,%str( ));
|
||||||
|
%if &extr_word=&base_word %then %let match=1;
|
||||||
|
%end;
|
||||||
|
%if &match=1 %then %let outvar=&outvar &extr_word;
|
||||||
|
%end;
|
||||||
|
|
||||||
|
&outvar
|
||||||
|
|
||||||
|
%mend mf_wordsInStr1andStr2;
|
||||||
|
|
||||||
@@ -62,13 +62,13 @@
|
|||||||
%put output location=&jref;
|
%put output location=&jref;
|
||||||
%if &action=OPEN %then %do;
|
%if &action=OPEN %then %do;
|
||||||
options nobomfile;
|
options nobomfile;
|
||||||
data _null_;file &jref encoding='utf-8';
|
data _null_;file &jref encoding='utf-8' ;
|
||||||
put '{"PROCESSED_DTTM" : "' "%sysfunc(datetime(),E8601DT26.6)" '"';
|
put '{"PROCESSED_DTTM" : "' "%sysfunc(datetime(),E8601DT26.6)" '"';
|
||||||
run;
|
run;
|
||||||
%end;
|
%end;
|
||||||
%else %if (&action=ARR or &action=OBJ) %then %do;
|
%else %if (&action=ARR or &action=OBJ) %then %do;
|
||||||
options validvarname=upcase;
|
options validvarname=upcase;
|
||||||
data _null_;file &jref mod encoding='utf-8';
|
data _null_;file &jref mod encoding='utf-8' ;
|
||||||
put ", ""%lowcase(%sysfunc(coalescec(&dslabel,&ds)))"":";
|
put ", ""%lowcase(%sysfunc(coalescec(&dslabel,&ds)))"":";
|
||||||
|
|
||||||
%if &engine=PROCJSON %then %do;
|
%if &engine=PROCJSON %then %do;
|
||||||
@@ -147,7 +147,7 @@
|
|||||||
run;
|
run;
|
||||||
%let ds=&fmtds;
|
%let ds=&fmtds;
|
||||||
%end; /* &fmt=Y */
|
%end; /* &fmt=Y */
|
||||||
data _null_;file &jref mod encoding='utf-8';
|
data _null_;file &jref mod encoding='utf-8' ;
|
||||||
put "["; call symputx('cols',0,'l');
|
put "["; call symputx('cols',0,'l');
|
||||||
proc sort
|
proc sort
|
||||||
data=sashelp.vcolumn(where=(libname='WORK' & memname="%upcase(&ds)"))
|
data=sashelp.vcolumn(where=(libname='WORK' & memname="%upcase(&ds)"))
|
||||||
@@ -192,7 +192,7 @@
|
|||||||
/* write to temp loc to avoid _webout truncation
|
/* write to temp loc to avoid _webout truncation
|
||||||
- https://support.sas.com/kb/49/325.html */
|
- https://support.sas.com/kb/49/325.html */
|
||||||
filename _sjs temp lrecl=131068 encoding='utf-8';
|
filename _sjs temp lrecl=131068 encoding='utf-8';
|
||||||
data _null_; file _sjs lrecl=131068 encoding='utf-8' mod;
|
data _null_; file _sjs lrecl=131068 encoding='utf-8' mod ;
|
||||||
set &tempds;
|
set &tempds;
|
||||||
if _n_>1 then put "," @; put
|
if _n_>1 then put "," @; put
|
||||||
%if &action=ARR %then "[" ; %else "{" ;
|
%if &action=ARR %then "[" ; %else "{" ;
|
||||||
@@ -219,14 +219,14 @@
|
|||||||
rc = fclose(fileid);
|
rc = fclose(fileid);
|
||||||
run;
|
run;
|
||||||
filename _sjs clear;
|
filename _sjs clear;
|
||||||
data _null_; file &jref mod encoding='utf-8';
|
data _null_; file &jref mod encoding='utf-8' ;
|
||||||
put "]";
|
put "]";
|
||||||
run;
|
run;
|
||||||
%end;
|
%end;
|
||||||
%end;
|
%end;
|
||||||
|
|
||||||
%else %if &action=CLOSE %then %do;
|
%else %if &action=CLOSE %then %do;
|
||||||
data _null_;file &jref encoding='utf-8' mod;
|
data _null_;file &jref encoding='utf-8' mod ;
|
||||||
put "}";
|
put "}";
|
||||||
run;
|
run;
|
||||||
%end;
|
%end;
|
||||||
|
|||||||
@@ -3,13 +3,15 @@
|
|||||||
@brief Reset an option to original value
|
@brief Reset an option to original value
|
||||||
@details Inspired by the SAS Jedi -
|
@details Inspired by the SAS Jedi -
|
||||||
https://blogs.sas.com/content/sastraining/2012/08/14/jedi-sas-tricks-reset-sas-system-options
|
https://blogs.sas.com/content/sastraining/2012/08/14/jedi-sas-tricks-reset-sas-system-options
|
||||||
Called as follows:
|
|
||||||
|
|
||||||
options obs=30;
|
Called as follows:
|
||||||
%mp_resetoption(OBS)
|
|
||||||
|
options obs=30 ps=max;
|
||||||
|
%mp_resetoption(OBS)
|
||||||
|
%mp_resetoption(PS)
|
||||||
|
|
||||||
|
|
||||||
@param option the option to reset
|
@param [in] option the option to reset
|
||||||
|
|
||||||
@version 9.2
|
@version 9.2
|
||||||
@author Allan Bowe
|
@author Allan Bowe
|
||||||
|
|||||||
@@ -11,9 +11,7 @@
|
|||||||
|
|
||||||
This macro will only work for BASE (V9) engine libraries. It works by
|
This macro will only work for BASE (V9) engine libraries. It works by
|
||||||
creating a copy of the dataset (without data, WITH constraints) in the same
|
creating a copy of the dataset (without data, WITH constraints) in the same
|
||||||
library, appending a sorted view into it, and finally - renaming it. By
|
library, appending a sorted view into it, and finally - renaming it.
|
||||||
default, COMPRESS=CHAR and REUSE=YES will be applied, this behaviour can
|
|
||||||
be adjusted using the `dsoptions=` parameter.
|
|
||||||
|
|
||||||
Example usage:
|
Example usage:
|
||||||
|
|
||||||
@@ -41,7 +39,6 @@
|
|||||||
|
|
||||||
@version 9.2
|
@version 9.2
|
||||||
@author Allan Bowe
|
@author Allan Bowe
|
||||||
@source https://github.com/sasjs/core
|
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
|
|||||||
@@ -94,13 +94,13 @@ data _null_;
|
|||||||
put '%put output location=&jref; ';
|
put '%put output location=&jref; ';
|
||||||
put '%if &action=OPEN %then %do; ';
|
put '%if &action=OPEN %then %do; ';
|
||||||
put ' options nobomfile; ';
|
put ' options nobomfile; ';
|
||||||
put ' data _null_;file &jref encoding=''utf-8''; ';
|
put ' data _null_;file &jref encoding=''utf-8'' ; ';
|
||||||
put ' put ''{"PROCESSED_DTTM" : "'' "%sysfunc(datetime(),E8601DT26.6)" ''"''; ';
|
put ' put ''{"PROCESSED_DTTM" : "'' "%sysfunc(datetime(),E8601DT26.6)" ''"''; ';
|
||||||
put ' run; ';
|
put ' run; ';
|
||||||
put '%end; ';
|
put '%end; ';
|
||||||
put '%else %if (&action=ARR or &action=OBJ) %then %do; ';
|
put '%else %if (&action=ARR or &action=OBJ) %then %do; ';
|
||||||
put ' options validvarname=upcase; ';
|
put ' options validvarname=upcase; ';
|
||||||
put ' data _null_;file &jref mod encoding=''utf-8''; ';
|
put ' data _null_;file &jref mod encoding=''utf-8'' ; ';
|
||||||
put ' put ", ""%lowcase(%sysfunc(coalescec(&dslabel,&ds)))"":"; ';
|
put ' put ", ""%lowcase(%sysfunc(coalescec(&dslabel,&ds)))"":"; ';
|
||||||
put ' ';
|
put ' ';
|
||||||
put ' %if &engine=PROCJSON %then %do; ';
|
put ' %if &engine=PROCJSON %then %do; ';
|
||||||
@@ -179,7 +179,7 @@ data _null_;
|
|||||||
put ' run; ';
|
put ' run; ';
|
||||||
put ' %let ds=&fmtds; ';
|
put ' %let ds=&fmtds; ';
|
||||||
put ' %end; /* &fmt=Y */ ';
|
put ' %end; /* &fmt=Y */ ';
|
||||||
put ' data _null_;file &jref mod encoding=''utf-8''; ';
|
put ' data _null_;file &jref mod encoding=''utf-8'' ; ';
|
||||||
put ' put "["; call symputx(''cols'',0,''l''); ';
|
put ' put "["; call symputx(''cols'',0,''l''); ';
|
||||||
put ' proc sort ';
|
put ' proc sort ';
|
||||||
put ' data=sashelp.vcolumn(where=(libname=''WORK'' & memname="%upcase(&ds)")) ';
|
put ' data=sashelp.vcolumn(where=(libname=''WORK'' & memname="%upcase(&ds)")) ';
|
||||||
@@ -224,7 +224,7 @@ data _null_;
|
|||||||
put ' /* write to temp loc to avoid _webout truncation ';
|
put ' /* write to temp loc to avoid _webout truncation ';
|
||||||
put ' - https://support.sas.com/kb/49/325.html */ ';
|
put ' - https://support.sas.com/kb/49/325.html */ ';
|
||||||
put ' filename _sjs temp lrecl=131068 encoding=''utf-8''; ';
|
put ' filename _sjs temp lrecl=131068 encoding=''utf-8''; ';
|
||||||
put ' data _null_; file _sjs lrecl=131068 encoding=''utf-8'' mod; ';
|
put ' data _null_; file _sjs lrecl=131068 encoding=''utf-8'' mod ; ';
|
||||||
put ' set &tempds; ';
|
put ' set &tempds; ';
|
||||||
put ' if _n_>1 then put "," @; put ';
|
put ' if _n_>1 then put "," @; put ';
|
||||||
put ' %if &action=ARR %then "[" ; %else "{" ; ';
|
put ' %if &action=ARR %then "[" ; %else "{" ; ';
|
||||||
@@ -251,14 +251,14 @@ data _null_;
|
|||||||
put ' rc = fclose(fileid); ';
|
put ' rc = fclose(fileid); ';
|
||||||
put ' run; ';
|
put ' run; ';
|
||||||
put ' filename _sjs clear; ';
|
put ' filename _sjs clear; ';
|
||||||
put ' data _null_; file &jref mod encoding=''utf-8''; ';
|
put ' data _null_; file &jref mod encoding=''utf-8'' ; ';
|
||||||
put ' put "]"; ';
|
put ' put "]"; ';
|
||||||
put ' run; ';
|
put ' run; ';
|
||||||
put ' %end; ';
|
put ' %end; ';
|
||||||
put '%end; ';
|
put '%end; ';
|
||||||
put ' ';
|
put ' ';
|
||||||
put '%else %if &action=CLOSE %then %do; ';
|
put '%else %if &action=CLOSE %then %do; ';
|
||||||
put ' data _null_;file &jref encoding=''utf-8'' mod; ';
|
put ' data _null_;file &jref encoding=''utf-8'' mod ; ';
|
||||||
put ' put "}"; ';
|
put ' put "}"; ';
|
||||||
put ' run; ';
|
put ' run; ';
|
||||||
put '%end; ';
|
put '%end; ';
|
||||||
|
|||||||
@@ -79,7 +79,7 @@
|
|||||||
OPTIONS NOBOMFILE;
|
OPTIONS NOBOMFILE;
|
||||||
|
|
||||||
/* setup json */
|
/* setup json */
|
||||||
data _null_;file &fref encoding='utf-8';
|
data _null_;file &fref encoding='utf-8' termstr=lf;
|
||||||
%if %str(&_debug) ge 131 %then %do;
|
%if %str(&_debug) ge 131 %then %do;
|
||||||
put '>>weboutBEGIN<<';
|
put '>>weboutBEGIN<<';
|
||||||
%end;
|
%end;
|
||||||
@@ -108,14 +108,14 @@
|
|||||||
i+1;
|
i+1;
|
||||||
call symputx('wt'!!left(i),name,'l');
|
call symputx('wt'!!left(i),name,'l');
|
||||||
call symputx('wtcnt',i,'l');
|
call symputx('wtcnt',i,'l');
|
||||||
data _null_; file &fref mod encoding='utf-8';
|
data _null_; file &fref mod encoding='utf-8' termstr=lf;
|
||||||
put ",""WORK"":{";
|
put ",""WORK"":{";
|
||||||
%do i=1 %to &wtcnt;
|
%do i=1 %to &wtcnt;
|
||||||
%let wt=&&wt&i;
|
%let wt=&&wt&i;
|
||||||
proc contents noprint data=&wt
|
proc contents noprint data=&wt
|
||||||
out=_data_ (keep=name type length format:);
|
out=_data_ (keep=name type length format:);
|
||||||
run;%let tempds=%scan(&syslast,2,.);
|
run;%let tempds=%scan(&syslast,2,.);
|
||||||
data _null_; file &fref mod encoding='utf-8';
|
data _null_; file &fref mod encoding='utf-8' termstr=lf;
|
||||||
dsid=open("WORK.&wt",'is');
|
dsid=open("WORK.&wt",'is');
|
||||||
nlobs=attrn(dsid,'NLOBS');
|
nlobs=attrn(dsid,'NLOBS');
|
||||||
nvars=attrn(dsid,'NVARS');
|
nvars=attrn(dsid,'NVARS');
|
||||||
@@ -126,15 +126,15 @@
|
|||||||
put ',"nvars":' nvars;
|
put ',"nvars":' nvars;
|
||||||
%mp_jsonout(OBJ,&tempds,jref=&fref,dslabel=colattrs,engine=DATASTEP)
|
%mp_jsonout(OBJ,&tempds,jref=&fref,dslabel=colattrs,engine=DATASTEP)
|
||||||
%mp_jsonout(OBJ,&wt,jref=&fref,dslabel=first10rows,engine=DATASTEP)
|
%mp_jsonout(OBJ,&wt,jref=&fref,dslabel=first10rows,engine=DATASTEP)
|
||||||
data _null_; file &fref mod encoding='utf-8';
|
data _null_; file &fref mod encoding='utf-8' termstr=lf;
|
||||||
put "}";
|
put "}";
|
||||||
%end;
|
%end;
|
||||||
data _null_; file &fref mod encoding='utf-8';
|
data _null_; file &fref mod encoding='utf-8' termstr=lf termstr=lf;
|
||||||
put "}";
|
put "}";
|
||||||
run;
|
run;
|
||||||
%end;
|
%end;
|
||||||
/* close off json */
|
/* close off json */
|
||||||
data _null_;file &fref mod encoding='utf-8';
|
data _null_;file &fref mod encoding='utf-8' termstr=lf;
|
||||||
_PROGRAM=quote(trim(resolve(symget('_PROGRAM'))));
|
_PROGRAM=quote(trim(resolve(symget('_PROGRAM'))));
|
||||||
put ",""SYSUSERID"" : ""&sysuserid"" ";
|
put ",""SYSUSERID"" : ""&sysuserid"" ";
|
||||||
put ",""MF_GETUSER"" : ""%mf_getuser()"" ";
|
put ",""MF_GETUSER"" : ""%mf_getuser()"" ";
|
||||||
@@ -147,7 +147,9 @@
|
|||||||
put ",""SYSHOSTNAME"" : ""&syshostname"" ";
|
put ",""SYSHOSTNAME"" : ""&syshostname"" ";
|
||||||
put ",""SYSPROCESSID"" : ""&SYSPROCESSID"" ";
|
put ",""SYSPROCESSID"" : ""&SYSPROCESSID"" ";
|
||||||
put ",""SYSPROCESSMODE"" : ""&SYSPROCESSMODE"" ";
|
put ",""SYSPROCESSMODE"" : ""&SYSPROCESSMODE"" ";
|
||||||
put ",""SYSPROCESSNAME"" : ""&SYSPROCESSNAME"" ";
|
length SYSPROCESSNAME $512;
|
||||||
|
SYSPROCESSNAME=quote(urlencode(cats(SYSPROCESSNAME)));
|
||||||
|
put ",""SYSPROCESSNAME"" : " SYSPROCESSNAME;
|
||||||
put ",""SYSJOBID"" : ""&sysjobid"" ";
|
put ",""SYSJOBID"" : ""&sysjobid"" ";
|
||||||
put ",""SYSSCPL"" : ""&sysscpl"" ";
|
put ",""SYSSCPL"" : ""&sysscpl"" ";
|
||||||
put ",""SYSSITE"" : ""&syssite"" ";
|
put ",""SYSSITE"" : ""&syssite"" ";
|
||||||
@@ -156,7 +158,8 @@
|
|||||||
put ',"SYSVLONG" : ' sysvlong;
|
put ',"SYSVLONG" : ' sysvlong;
|
||||||
put ",""SYSWARNINGTEXT"" : ""&syswarningtext"" ";
|
put ",""SYSWARNINGTEXT"" : ""&syswarningtext"" ";
|
||||||
put ',"END_DTTM" : "' "%sysfunc(datetime(),datetime20.3)" '" ';
|
put ',"END_DTTM" : "' "%sysfunc(datetime(),datetime20.3)" '" ';
|
||||||
autoexec=quote(trim(getoption('autoexec')));
|
length autoexec $512;
|
||||||
|
autoexec=quote(urlencode(trim(getoption('autoexec'))));
|
||||||
put ',"AUTOEXEC" : ' autoexec;
|
put ',"AUTOEXEC" : ' autoexec;
|
||||||
memsize="%sysfunc(INPUTN(%sysfunc(getoption(memsize)), best.),sizekmg.)";
|
memsize="%sysfunc(INPUTN(%sysfunc(getoption(memsize)), best.),sizekmg.)";
|
||||||
memsize=quote(cats(memsize));
|
memsize=quote(cats(memsize));
|
||||||
|
|||||||
20
tests/crossplatform/mf_wordsinstr1andstr2.test.sas
Normal file
20
tests/crossplatform/mf_wordsinstr1andstr2.test.sas
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
/**
|
||||||
|
@file
|
||||||
|
@brief Testing mf_wordsinstr1andstr2 macro
|
||||||
|
|
||||||
|
<h4> SAS Macros </h4>
|
||||||
|
@li mf_wordsinstr1andstr2.sas
|
||||||
|
@li mp_assert.sas
|
||||||
|
|
||||||
|
**/
|
||||||
|
|
||||||
|
%let x=%mf_wordsinstr1andstr2(str1=xx DOLLAR x $CHAR xxx W MONNAME
|
||||||
|
,str2=DOLLAR $CHAR W MONNAME xxxxxx
|
||||||
|
);
|
||||||
|
%mp_assert(
|
||||||
|
iftrue=(
|
||||||
|
"&x"="DOLLAR $CHAR W MONNAME"
|
||||||
|
),
|
||||||
|
desc=Checking basic string,
|
||||||
|
outds=work.test_results
|
||||||
|
)
|
||||||
20
tests/crossplatform/mf_wordsinstr1butnotstr2.test.sas
Normal file
20
tests/crossplatform/mf_wordsinstr1butnotstr2.test.sas
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
/**
|
||||||
|
@file
|
||||||
|
@brief Testing mf_wordsinstr1butnotstr2 macro
|
||||||
|
|
||||||
|
<h4> SAS Macros </h4>
|
||||||
|
@li mf_wordsinstr1butnotstr2.sas
|
||||||
|
@li mp_assert.sas
|
||||||
|
|
||||||
|
**/
|
||||||
|
|
||||||
|
%let x=%mf_wordsinstr1butnotstr2(str1=xx DOLLAR x $CHAR xxx W MONNAME
|
||||||
|
,str2=ff xx x xxx xxxxxx
|
||||||
|
);
|
||||||
|
%mp_assert(
|
||||||
|
iftrue=(
|
||||||
|
"&x"="DOLLAR $CHAR W MONNAME"
|
||||||
|
),
|
||||||
|
desc=Checking basic string,
|
||||||
|
outds=work.test_results
|
||||||
|
)
|
||||||
@@ -242,13 +242,13 @@ data _null_;
|
|||||||
put '%put output location=&jref; ';
|
put '%put output location=&jref; ';
|
||||||
put '%if &action=OPEN %then %do; ';
|
put '%if &action=OPEN %then %do; ';
|
||||||
put ' options nobomfile; ';
|
put ' options nobomfile; ';
|
||||||
put ' data _null_;file &jref encoding=''utf-8''; ';
|
put ' data _null_;file &jref encoding=''utf-8'' ; ';
|
||||||
put ' put ''{"PROCESSED_DTTM" : "'' "%sysfunc(datetime(),E8601DT26.6)" ''"''; ';
|
put ' put ''{"PROCESSED_DTTM" : "'' "%sysfunc(datetime(),E8601DT26.6)" ''"''; ';
|
||||||
put ' run; ';
|
put ' run; ';
|
||||||
put '%end; ';
|
put '%end; ';
|
||||||
put '%else %if (&action=ARR or &action=OBJ) %then %do; ';
|
put '%else %if (&action=ARR or &action=OBJ) %then %do; ';
|
||||||
put ' options validvarname=upcase; ';
|
put ' options validvarname=upcase; ';
|
||||||
put ' data _null_;file &jref mod encoding=''utf-8''; ';
|
put ' data _null_;file &jref mod encoding=''utf-8'' ; ';
|
||||||
put ' put ", ""%lowcase(%sysfunc(coalescec(&dslabel,&ds)))"":"; ';
|
put ' put ", ""%lowcase(%sysfunc(coalescec(&dslabel,&ds)))"":"; ';
|
||||||
put ' ';
|
put ' ';
|
||||||
put ' %if &engine=PROCJSON %then %do; ';
|
put ' %if &engine=PROCJSON %then %do; ';
|
||||||
@@ -327,7 +327,7 @@ data _null_;
|
|||||||
put ' run; ';
|
put ' run; ';
|
||||||
put ' %let ds=&fmtds; ';
|
put ' %let ds=&fmtds; ';
|
||||||
put ' %end; /* &fmt=Y */ ';
|
put ' %end; /* &fmt=Y */ ';
|
||||||
put ' data _null_;file &jref mod encoding=''utf-8''; ';
|
put ' data _null_;file &jref mod encoding=''utf-8'' ; ';
|
||||||
put ' put "["; call symputx(''cols'',0,''l''); ';
|
put ' put "["; call symputx(''cols'',0,''l''); ';
|
||||||
put ' proc sort ';
|
put ' proc sort ';
|
||||||
put ' data=sashelp.vcolumn(where=(libname=''WORK'' & memname="%upcase(&ds)")) ';
|
put ' data=sashelp.vcolumn(where=(libname=''WORK'' & memname="%upcase(&ds)")) ';
|
||||||
@@ -372,7 +372,7 @@ data _null_;
|
|||||||
put ' /* write to temp loc to avoid _webout truncation ';
|
put ' /* write to temp loc to avoid _webout truncation ';
|
||||||
put ' - https://support.sas.com/kb/49/325.html */ ';
|
put ' - https://support.sas.com/kb/49/325.html */ ';
|
||||||
put ' filename _sjs temp lrecl=131068 encoding=''utf-8''; ';
|
put ' filename _sjs temp lrecl=131068 encoding=''utf-8''; ';
|
||||||
put ' data _null_; file _sjs lrecl=131068 encoding=''utf-8'' mod; ';
|
put ' data _null_; file _sjs lrecl=131068 encoding=''utf-8'' mod ; ';
|
||||||
put ' set &tempds; ';
|
put ' set &tempds; ';
|
||||||
put ' if _n_>1 then put "," @; put ';
|
put ' if _n_>1 then put "," @; put ';
|
||||||
put ' %if &action=ARR %then "[" ; %else "{" ; ';
|
put ' %if &action=ARR %then "[" ; %else "{" ; ';
|
||||||
@@ -399,14 +399,14 @@ data _null_;
|
|||||||
put ' rc = fclose(fileid); ';
|
put ' rc = fclose(fileid); ';
|
||||||
put ' run; ';
|
put ' run; ';
|
||||||
put ' filename _sjs clear; ';
|
put ' filename _sjs clear; ';
|
||||||
put ' data _null_; file &jref mod encoding=''utf-8''; ';
|
put ' data _null_; file &jref mod encoding=''utf-8'' ; ';
|
||||||
put ' put "]"; ';
|
put ' put "]"; ';
|
||||||
put ' run; ';
|
put ' run; ';
|
||||||
put ' %end; ';
|
put ' %end; ';
|
||||||
put '%end; ';
|
put '%end; ';
|
||||||
put ' ';
|
put ' ';
|
||||||
put '%else %if &action=CLOSE %then %do; ';
|
put '%else %if &action=CLOSE %then %do; ';
|
||||||
put ' data _null_;file &jref encoding=''utf-8'' mod; ';
|
put ' data _null_;file &jref encoding=''utf-8'' mod ; ';
|
||||||
put ' put "}"; ';
|
put ' put "}"; ';
|
||||||
put ' run; ';
|
put ' run; ';
|
||||||
put '%end; ';
|
put '%end; ';
|
||||||
|
|||||||
Reference in New Issue
Block a user