mirror of
https://github.com/sasjs/core.git
synced 2025-12-10 14:04:36 +00:00
chore: regenerated web service macros
This commit is contained in:
@@ -242,7 +242,8 @@ data _null_;
|
||||
put ' ,showmeta=N ';
|
||||
put ' ,maxobs=MAX ';
|
||||
put ')/*/STORE SOURCE*/; ';
|
||||
put '%local tempds colinfo fmtds i numcols stmt_obs tempvar lastobs optval; ';
|
||||
put '%local tempds colinfo fmtds i numcols numobs stmt_obs lastobs optval ';
|
||||
put ' tmpds1 tmpds2 tmpds3 tmpds4; ';
|
||||
put '%let numcols=0; ';
|
||||
put '%if &maxobs ne MAX %then %let stmt_obs=%str(if _n_>&maxobs then stop;); ';
|
||||
put ' ';
|
||||
@@ -280,7 +281,7 @@ data _null_;
|
||||
put ' by varnum; ';
|
||||
put ' run; ';
|
||||
put ' /* move meta to mac vars */ ';
|
||||
put ' data _null_; ';
|
||||
put ' data &colinfo; ';
|
||||
put ' if _n_=1 then call symputx(''numcols'',nobs,''l''); ';
|
||||
put ' set &colinfo end=last nobs=nobs; ';
|
||||
put ' name=upcase(name); ';
|
||||
@@ -301,18 +302,17 @@ data _null_;
|
||||
put ' end; ';
|
||||
put ' /* 32 char unique name */ ';
|
||||
put ' newname=''sasjs''!!substr(cats(put(md5(name),$hex32.)),1,27); ';
|
||||
put ' maxlenv=''maxlen''!!substr(cats(put(md5(name),$hex32.)),1,26); ';
|
||||
put ' ';
|
||||
put ' call symputx(cats(''name'',_n_),name,''l''); ';
|
||||
put ' call symputx(cats(''newname'',_n_),newname,''l''); ';
|
||||
put ' call symputx(cats(''maxlenv'',_n_),maxlenv,''l''); ';
|
||||
put ' call symputx(cats(''length'',_n_),length,''l''); ';
|
||||
put ' /* overwritten when fmt=Y */ ';
|
||||
put ' call symputx(cats(''fmtlen'',_n_),min(32767,ceil((length+3)*1.2)),''l''); ';
|
||||
put ' call symputx(cats(''fmt'',_n_),fmt,''l''); ';
|
||||
put ' call symputx(cats(''type'',_n_),type,''l''); ';
|
||||
put ' call symputx(cats(''typelong'',_n_),typelong,''l''); ';
|
||||
put ' call symputx(cats(''label'',_n_),coalescec(label,name),''l''); ';
|
||||
put ' /* overwritten when fmt=Y and a custom format exists in catalog */ ';
|
||||
put ' if typelong=''num'' then call symputx(cats(''fmtlen'',_n_),200,''l''); ';
|
||||
put ' else call symputx(cats(''fmtlen'',_n_),min(32767,ceil((length+3)*1.5)),''l''); ';
|
||||
put ' run; ';
|
||||
put ' ';
|
||||
put ' %let tempds=%substr(_%sysfunc(compress(%sysfunc(uuidgen()),-)),1,32); ';
|
||||
@@ -355,30 +355,82 @@ data _null_;
|
||||
put ' %end; ';
|
||||
put ' ';
|
||||
put ' %if &fmt=Y %then %do; ';
|
||||
put ' %let tempvar=%substr(_%sysfunc(compress(%sysfunc(uuidgen()),-)),1,32); ';
|
||||
put ' /* need to find max length of formatted values */ ';
|
||||
put ' /** ';
|
||||
put ' * Extract format definitions ';
|
||||
put ' * First, by getting library locations from dictionary.formats ';
|
||||
put ' * Then, by exporting the width using proc format ';
|
||||
put ' * Cannot use maxw from sashelp.vformat as not always populated ';
|
||||
put ' * Cannot use fmtinfo() as not supported in all flavours ';
|
||||
put ' */ ';
|
||||
put ' %let tmpds1=%substr(fmtsum%sysfunc(compress(%sysfunc(uuidgen()),-)),1,32); ';
|
||||
put ' %let tmpds2=%substr(cntl%sysfunc(compress(%sysfunc(uuidgen()),-)),1,32); ';
|
||||
put ' %let tmpds3=%substr(cntl%sysfunc(compress(%sysfunc(uuidgen()),-)),1,32); ';
|
||||
put ' %let tmpds4=%substr(col%sysfunc(compress(%sysfunc(uuidgen()),-)),1,32); ';
|
||||
put ' proc sql noprint; ';
|
||||
put ' create table &tmpds1 as ';
|
||||
put ' select cats(libname,''.'',memname) as fmtcat, ';
|
||||
put ' fmtname ';
|
||||
put ' from dictionary.formats ';
|
||||
put ' where fmttype=''F'' and libname is not null ';
|
||||
put ' and fmtname in (select format from &colinfo where format is not null) ';
|
||||
put ' order by 1; ';
|
||||
put ' create table &tmpds2( ';
|
||||
put ' FMTNAME char(32), ';
|
||||
put ' MAX num length=3 ';
|
||||
put ' ); ';
|
||||
put ' %local catlist cat fmtlist i; ';
|
||||
put ' select distinct fmtcat into: catlist separated by '' '' from &tmpds1; ';
|
||||
put ' %do i=1 %to %sysfunc(countw(&catlist,%str( ))); ';
|
||||
put ' %let cat=%scan(&catlist,&i,%str( )); ';
|
||||
put ' proc sql; ';
|
||||
put ' select distinct fmtname into: fmtlist separated by '' '' ';
|
||||
put ' from &tmpds1 where fmtcat="&cat"; ';
|
||||
put ' proc format lib=&cat cntlout=&tmpds3(keep=fmtname max); ';
|
||||
put ' select &fmtlist; ';
|
||||
put ' run; ';
|
||||
put ' proc sql; ';
|
||||
put ' insert into &tmpds2 select distinct fmtname,max from &tmpds3; ';
|
||||
put ' %end; ';
|
||||
put ' ';
|
||||
put ' proc sql; ';
|
||||
put ' create table &tmpds4 as ';
|
||||
put ' select a.*, b.max as maxw ';
|
||||
put ' from &colinfo a ';
|
||||
put ' left join &tmpds2 b ';
|
||||
put ' on cats(a.format)=cats(upcase(b.fmtname)) ';
|
||||
put ' order by a.varnum; ';
|
||||
put ' data _null_; ';
|
||||
put ' set &tmpds4; ';
|
||||
put ' if not missing(maxw); ';
|
||||
put ' call symputx( ';
|
||||
put ' cats(''fmtlen'',_n_), ';
|
||||
put ' /* vars need extra padding due to JSON escaping of special chars */ ';
|
||||
put ' min(32767,ceil((max(length,maxw)+3)*1.5)) ';
|
||||
put ' ,''l'' ';
|
||||
put ' ); ';
|
||||
put ' run; ';
|
||||
put ' ';
|
||||
put ' /* configure varlenchk - as we are explicitly shortening the variables */ ';
|
||||
put ' %let optval=%sysfunc(getoption(varlenchk)); ';
|
||||
put ' options varlenchk=NOWARN; ';
|
||||
put ' data _data_(compress=char); ';
|
||||
put ' /* shorten the new vars */ ';
|
||||
put ' length ';
|
||||
put ' %do i=1 %to &numcols; ';
|
||||
put ' &&name&i $&&fmtlen&i ';
|
||||
put ' %end; ';
|
||||
put ' ; ';
|
||||
put ' /* rename on entry */ ';
|
||||
put ' set &ds(rename=( ';
|
||||
put ' %do i=1 %to &numcols; ';
|
||||
put ' &&name&i=&&newname&i ';
|
||||
put ' &&name&i=&&newname&i ';
|
||||
put ' %end; ';
|
||||
put ' )); ';
|
||||
put ' &stmt_obs; ';
|
||||
put ' /* formatted values can be up to length 32767 */ ';
|
||||
put ' length ';
|
||||
put ' ';
|
||||
put ' drop ';
|
||||
put ' %do i=1 %to &numcols; ';
|
||||
put ' &&name&i ';
|
||||
put ' %end; ';
|
||||
put ' $32767; ';
|
||||
put ' retain &tempvar ';
|
||||
put ' %do i=1 %to &numcols; ';
|
||||
put ' &&maxlenv&i ';
|
||||
put ' %end; ';
|
||||
put ' 0; ';
|
||||
put ' drop &tempvar ';
|
||||
put ' %do i=1 %to &numcols; ';
|
||||
put ' &&newname&i &&maxlenv&i ';
|
||||
put ' &&newname&i ';
|
||||
put ' %end; ';
|
||||
put ' ; ';
|
||||
put ' %do i=1 %to &numcols; ';
|
||||
@@ -388,19 +440,14 @@ data _null_;
|
||||
put ' %else %do; ';
|
||||
put ' &&name&i=put(&&newname&i,&&fmt&i); ';
|
||||
put ' %end; ';
|
||||
put ' /* grab max length of each value as we move down the data step */ ';
|
||||
put ' &tempvar=length(&&name&i); ';
|
||||
put ' if &tempvar>&&maxlenv&i then &&maxlenv&i=&tempvar; ';
|
||||
put ' %end; ';
|
||||
put ' if _n_=&lastobs then do; ';
|
||||
put ' /* add a 20% buffer in case of special chars that need to be escaped */ ';
|
||||
put ' %do i=1 %to &numcols; ';
|
||||
put ' call symputx("fmtlen&i",min(32767,ceil((&&maxlenv&i+3)*1.2)),''l''); ';
|
||||
put ' %end; ';
|
||||
put ' if _error_ then do; ';
|
||||
put ' call symputx(''syscc'',1012); ';
|
||||
put ' stop; ';
|
||||
put ' end; ';
|
||||
put ' if _error_ then call symputx(''syscc'',1012); ';
|
||||
put ' run; ';
|
||||
put ' %let fmtds=&syslast; ';
|
||||
put ' options varlenchk=&optval; ';
|
||||
put ' %end; ';
|
||||
put ' ';
|
||||
put ' proc format; /* credit yabwon for special null removal */ ';
|
||||
@@ -415,9 +462,6 @@ data _null_;
|
||||
put ' %end; ';
|
||||
put ' other = [best.]; ';
|
||||
put ' ';
|
||||
put ' /* configure varlenchk - as we are explicitly shortening the variables */ ';
|
||||
put ' %let optval=%sysfunc(getoption(varlenchk)); ';
|
||||
put ' options varlenchk=NOWARN; ';
|
||||
put ' data &tempds; ';
|
||||
put ' attrib _all_ label=''''; ';
|
||||
put ' %do i=1 %to &numcols; ';
|
||||
@@ -456,7 +500,6 @@ data _null_;
|
||||
put ' %end; ';
|
||||
put ' %end; ';
|
||||
put ' run; ';
|
||||
put ' options varlenchk=&optval; ';
|
||||
put ' ';
|
||||
put ' filename _sjs3 temp lrecl=131068 ; ';
|
||||
put ' data _null_; ';
|
||||
@@ -546,7 +589,7 @@ data _null_;
|
||||
put ' %quote(&user) ';
|
||||
put ' ';
|
||||
put '%mend mf_getuser; ';
|
||||
put '%macro mv_webout(action,ds,fref=_mvwtemp,dslabel=,fmt=Y,stream=Y,missing=NULL ';
|
||||
put '%macro mv_webout(action,ds,fref=_mvwtemp,dslabel=,fmt=N,stream=Y,missing=NULL ';
|
||||
put ' ,showmeta=N,maxobs=MAX ';
|
||||
put '); ';
|
||||
put '%global _webin_file_count _webin_fileuri _debug _omittextlog _webin_name ';
|
||||
|
||||
Reference in New Issue
Block a user