mirror of
https://github.com/sasjs/core.git
synced 2025-12-10 22:14:35 +00:00
feat: ensuring mX_webout services run without MEMSIZE, closes #142. Also adding note2err in mp_init().
This commit is contained in:
@@ -139,8 +139,9 @@ create table datalines1 as
|
|||||||
/**
|
/**
|
||||||
Due to long decimals cannot use best. format
|
Due to long decimals cannot use best. format
|
||||||
So - use bestd. format and then use character functions to strip trailing
|
So - use bestd. format and then use character functions to strip trailing
|
||||||
zeros, if NOT an integer!!
|
zeros, if NOT an integer or missing!! Cannot use int() as it upsets
|
||||||
resolved code = ifc(int(VARIABLE)=VARIABLE
|
note2err when there are missings.
|
||||||
|
resolved code = ifc( mod(coalesce(VARIABLE,0),1)=0
|
||||||
,put(VARIABLE,best32.)
|
,put(VARIABLE,best32.)
|
||||||
,substrn(put(VARIABLE,bestd32.),1
|
,substrn(put(VARIABLE,bestd32.),1
|
||||||
,findc(put(VARIABLE,bestd32.),'0','TBK')));
|
,findc(put(VARIABLE,bestd32.),'0','TBK')));
|
||||||
@@ -151,7 +152,7 @@ data datalines_2;
|
|||||||
set datalines1 (where=(upcase(name) not in
|
set datalines1 (where=(upcase(name) not in
|
||||||
('PROCESSED_DTTM','VALID_FROM_DTTM','VALID_TO_DTTM')));
|
('PROCESSED_DTTM','VALID_FROM_DTTM','VALID_TO_DTTM')));
|
||||||
if type='num' then dataline=
|
if type='num' then dataline=
|
||||||
cats('ifc(int(',name,')=',name,'
|
cats('ifc(mod(coalesce(',name,',0),1)=0
|
||||||
,put(',name,',best32.-l)
|
,put(',name,',best32.-l)
|
||||||
,substrn(put(',name,',bestd32.-l),1
|
,substrn(put(',name,',bestd32.-l),1
|
||||||
,findc(put(',name,',bestd32.-l),"0","TBK")))');
|
,findc(put(',name,',bestd32.-l),"0","TBK")))');
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ data _null_;
|
|||||||
dsid=open("&ds.","i");
|
dsid=open("&ds.","i");
|
||||||
num=attrn(dsid,"nvars");
|
num=attrn(dsid,"nvars");
|
||||||
do i=1 to num;
|
do i=1 to num;
|
||||||
header = trim(left(coalescec(varlabel(dsid,i),varname(dsid,i))));
|
header = cats(coalescec(varlabel(dsid,i),varname(dsid,i)));
|
||||||
put header @;
|
put header @;
|
||||||
end;
|
end;
|
||||||
rc=close(dsid);
|
rc=close(dsid);
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ data &outds;
|
|||||||
output;
|
output;
|
||||||
end;
|
end;
|
||||||
if mod(SUBGROUP_ID,1) ne 0 then do;
|
if mod(SUBGROUP_ID,1) ne 0 then do;
|
||||||
REASON_CD='SUBGROUP_ID should be integer, not '!!left(subgroup_id);
|
REASON_CD='SUBGROUP_ID should be integer, not '!!cats(subgroup_id);
|
||||||
putlog REASON_CD= SUBGROUP_ID=;
|
putlog REASON_CD= SUBGROUP_ID=;
|
||||||
call symputx('reason_cd',reason_cd,'l');
|
call symputx('reason_cd',reason_cd,'l');
|
||||||
call symputx('nobs',_n_,'l');
|
call symputx('nobs',_n_,'l');
|
||||||
@@ -127,7 +127,7 @@ data &outds;
|
|||||||
if OPERATOR_NM not in
|
if OPERATOR_NM not in
|
||||||
('=','>','<','<=','>=','BETWEEN','IN','NOT IN','NE','CONTAINS')
|
('=','>','<','<=','>=','BETWEEN','IN','NOT IN','NE','CONTAINS')
|
||||||
then do;
|
then do;
|
||||||
REASON_CD='Invalid OPERATOR_NM: '!!left(OPERATOR_NM);
|
REASON_CD='Invalid OPERATOR_NM: '!!cats(OPERATOR_NM);
|
||||||
putlog REASON_CD= OPERATOR_NM=;
|
putlog REASON_CD= OPERATOR_NM=;
|
||||||
call symputx('reason_cd',reason_cd,'l');
|
call symputx('reason_cd',reason_cd,'l');
|
||||||
call symputx('nobs',_n_,'l');
|
call symputx('nobs',_n_,'l');
|
||||||
|
|||||||
@@ -158,7 +158,7 @@ run;
|
|||||||
lab=" label="!!cats("'",tranwrd(label,"'","''"),"'");
|
lab=" label="!!cats("'",tranwrd(label,"'","''"),"'");
|
||||||
if notnull='yes' then notnul=' not null';
|
if notnull='yes' then notnul=' not null';
|
||||||
if type='char' then typ=cats('char(',length,')');
|
if type='char' then typ=cats('char(',length,')');
|
||||||
else if length ne 8 then typ='num length='!!left(length);
|
else if length ne 8 then typ='num length='!!cats(length);
|
||||||
else typ='num';
|
else typ='num';
|
||||||
put name typ fmt notnul lab;
|
put name typ fmt notnul lab;
|
||||||
run;
|
run;
|
||||||
|
|||||||
@@ -51,6 +51,7 @@
|
|||||||
noautocorrect /* disallow misspelled procedure names */
|
noautocorrect /* disallow misspelled procedure names */
|
||||||
compress=CHAR /* default is none so ensure we have something! */
|
compress=CHAR /* default is none so ensure we have something! */
|
||||||
datastmtchk=ALLKEYWORDS /* protection from overwriting input datasets */
|
datastmtchk=ALLKEYWORDS /* protection from overwriting input datasets */
|
||||||
|
dsoptions=note2err /* undocumented - convert bad NOTEs to ERRs */
|
||||||
%str(err)orcheck=STRICT /* catch errs in libname/filename statements */
|
%str(err)orcheck=STRICT /* catch errs in libname/filename statements */
|
||||||
fmterr /* ensure err when a format cannot be found */
|
fmterr /* ensure err when a format cannot be found */
|
||||||
mergenoby=%str(ERR)OR /* throw err when a merge has no BY variables */
|
mergenoby=%str(ERR)OR /* throw err when a merge has no BY variables */
|
||||||
|
|||||||
@@ -76,7 +76,7 @@
|
|||||||
else do;
|
else do;
|
||||||
x+1;
|
x+1;
|
||||||
call symputx(name,quote(cats(value)),'l');
|
call symputx(name,quote(cats(value)),'l');
|
||||||
call symputx('pval'!!left(x),name,'l');
|
call symputx(cats('pval',x),name,'l');
|
||||||
call symputx('pcnt',x,'l');
|
call symputx('pcnt',x,'l');
|
||||||
end;
|
end;
|
||||||
run;
|
run;
|
||||||
|
|||||||
@@ -48,9 +48,11 @@
|
|||||||
%let tempcol=%mf_getuniquename();
|
%let tempcol=%mf_getuniquename();
|
||||||
|
|
||||||
%if &rule=ISINT %then %do;
|
%if &rule=ISINT %then %do;
|
||||||
&tempcol=input(&incol,?? best32.);
|
|
||||||
&outcol=0;
|
&outcol=0;
|
||||||
if not missing(&tempcol) then if mod(&incol,1)=0 then &outcol=1;
|
if not missing(&incol) then do;
|
||||||
|
&tempcol=input(&incol,?? best32.);
|
||||||
|
if not missing(&tempcol) then if mod(&tempcol,1)=0 then &outcol=1;
|
||||||
|
end;
|
||||||
drop &tempcol;
|
drop &tempcol;
|
||||||
%end;
|
%end;
|
||||||
%else %if &rule=ISNUM %then %do;
|
%else %if &rule=ISNUM %then %do;
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ data _null_;
|
|||||||
set repos;
|
set repos;
|
||||||
where repositorytype in('CUSTOM','FOUNDATION');
|
where repositorytype in('CUSTOM','FOUNDATION');
|
||||||
keep id name ;
|
keep id name ;
|
||||||
call symputx('repo'!!left(_n_),name,'l');
|
call symputx(cats('repo',_n_),name,'l');
|
||||||
call symputx('repocnt',_n_,'l');
|
call symputx('repocnt',_n_,'l');
|
||||||
run;
|
run;
|
||||||
|
|
||||||
|
|||||||
@@ -122,7 +122,7 @@
|
|||||||
set &tempds;
|
set &tempds;
|
||||||
if not (upcase(name) =:"DATA"); /* ignore temp datasets */
|
if not (upcase(name) =:"DATA"); /* ignore temp datasets */
|
||||||
i+1;
|
i+1;
|
||||||
call symputx('wt'!!left(i),name,'l');
|
call symputx(cats('wt',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';
|
||||||
put ",""WORK"":{";
|
put ",""WORK"":{";
|
||||||
@@ -166,6 +166,7 @@
|
|||||||
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)" '" ';
|
||||||
|
length memsize $32;
|
||||||
memsize="%sysfunc(INPUTN(%sysfunc(getoption(memsize)), best.),sizekmg.)";
|
memsize="%sysfunc(INPUTN(%sysfunc(getoption(memsize)), best.),sizekmg.)";
|
||||||
memsize=quote(cats(memsize));
|
memsize=quote(cats(memsize));
|
||||||
put ',"MEMSIZE" : ' memsize;
|
put ',"MEMSIZE" : ' memsize;
|
||||||
|
|||||||
@@ -114,7 +114,7 @@
|
|||||||
set &tempds;
|
set &tempds;
|
||||||
if not (upcase(name) =:"DATA"); /* ignore temp datasets */
|
if not (upcase(name) =:"DATA"); /* ignore temp datasets */
|
||||||
i+1;
|
i+1;
|
||||||
call symputx('wt'!!left(i),name,'l');
|
call symputx(cats('wt',i),name,'l');
|
||||||
call symputx('wtcnt',i,'l');
|
call symputx('wtcnt',i,'l');
|
||||||
data _null_; file &fref mod encoding='utf-8' termstr=lf;
|
data _null_; file &fref mod encoding='utf-8' termstr=lf;
|
||||||
put ",""WORK"":{";
|
put ",""WORK"":{";
|
||||||
@@ -165,6 +165,7 @@
|
|||||||
length autoexec $512;
|
length autoexec $512;
|
||||||
autoexec=quote(urlencode(trim(getoption('autoexec'))));
|
autoexec=quote(urlencode(trim(getoption('autoexec'))));
|
||||||
put ',"AUTOEXEC" : ' autoexec;
|
put ',"AUTOEXEC" : ' autoexec;
|
||||||
|
length memsize $32;
|
||||||
memsize="%sysfunc(INPUTN(%sysfunc(getoption(memsize)), best.),sizekmg.)";
|
memsize="%sysfunc(INPUTN(%sysfunc(getoption(memsize)), best.),sizekmg.)";
|
||||||
memsize=quote(cats(memsize));
|
memsize=quote(cats(memsize));
|
||||||
put ',"MEMSIZE" : ' memsize;
|
put ',"MEMSIZE" : ' memsize;
|
||||||
|
|||||||
@@ -112,6 +112,9 @@ datalines4;
|
|||||||
0
|
0
|
||||||
above are good
|
above are good
|
||||||
the rest are bad
|
the rest are bad
|
||||||
|
0.1
|
||||||
|
1.1
|
||||||
|
-0.001
|
||||||
%abort
|
%abort
|
||||||
1&somethingverybad.
|
1&somethingverybad.
|
||||||
&
|
&
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
<h4> SAS Macros </h4>
|
<h4> SAS Macros </h4>
|
||||||
@li mp_init.sas
|
@li mp_init.sas
|
||||||
|
@li mv_webout.sas
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
|
|||||||
@@ -272,7 +272,7 @@ data;run;%let jdswaitfor=&syslast;
|
|||||||
data _null_;
|
data _null_;
|
||||||
infile &jfref lrecl=32767;
|
infile &jfref lrecl=32767;
|
||||||
input;
|
input;
|
||||||
jparams='jparams'!!left(symget('jid'));
|
jparams=cats('jparams',symget('jid'));
|
||||||
call symputx(jparams,substr(_infile_,3,length(_infile_)-4));
|
call symputx(jparams,substr(_infile_,3,length(_infile_)-4));
|
||||||
run;
|
run;
|
||||||
%local jobuid&jid;
|
%local jobuid&jid;
|
||||||
|
|||||||
@@ -187,8 +187,8 @@
|
|||||||
set &tempds;
|
set &tempds;
|
||||||
if not (upcase(name) =:"DATA"); /* ignore temp datasets */
|
if not (upcase(name) =:"DATA"); /* ignore temp datasets */
|
||||||
i+1;
|
i+1;
|
||||||
call symputx('wt'!!left(i),name);
|
call symputx(cats('wt',i),name,'l');
|
||||||
call symputx('wtcnt',i);
|
call symputx('wtcnt',i,'l');
|
||||||
data _null_; file &fref mod; put ",""WORK"":{";
|
data _null_; file &fref mod; put ",""WORK"":{";
|
||||||
%do i=1 %to &wtcnt;
|
%do i=1 %to &wtcnt;
|
||||||
%let wt=&&wt&i;
|
%let wt=&&wt&i;
|
||||||
@@ -226,6 +226,7 @@
|
|||||||
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)" '" ';
|
||||||
|
length memsize $32;
|
||||||
memsize="%sysfunc(INPUTN(%sysfunc(getoption(memsize)), best.),sizekmg.)";
|
memsize="%sysfunc(INPUTN(%sysfunc(getoption(memsize)), best.),sizekmg.)";
|
||||||
memsize=quote(cats(memsize));
|
memsize=quote(cats(memsize));
|
||||||
put ',"MEMSIZE" : ' memsize;
|
put ',"MEMSIZE" : ' memsize;
|
||||||
|
|||||||
Reference in New Issue
Block a user