1
0
mirror of https://github.com/sasjs/core.git synced 2026-01-03 07:40:04 +00:00

fix: ensuring tests passing on sas 9

This commit is contained in:
munja
2022-05-11 13:32:27 +01:00
parent 1672c96340
commit 7dbe31b5d3
4 changed files with 167 additions and 67 deletions

View File

@@ -94,25 +94,34 @@ data &outds;
set &inds;
length reason_cd $4032 vtype $1 vnum dsid 8;
/* get column attributes */
dsid=open("&targetds","i");
if dsid<1 then do;
REASON_CD="Unable to assign &targetds";
putlog REASON_CD= dsid=;
call symputx('reason_cd',reason_cd,'l');
call symputx('nobs',_n_,'l');
output;
end;
vnum=varnum(dsid,VARIABLE_NM);
if vnum<1 then do;
REASON_CD=cats("Variable (",VARIABLE_NM,") not found in &targetds");
putlog REASON_CD= dsid=;
/* quick check to ensure column exists */
if upcase(VARIABLE_NM) not in
(%upcase(%mf_getvarlist(&targetds,dlm=%str(,),quote=SINGLE)))
then do;
REASON_CD="Variable "!!cats(variable_nm)!!" not in &targetds";
putlog REASON_CD= VARIABLE_NM=;
call symputx('reason_cd',reason_cd,'l');
call symputx('nobs',_n_,'l');
output;
return;
end;
vtype=vartype(dsid,vnum);
/* need to open the dataset to get the column type */
dsid=open("&targetds","i");
if dsid>0 then do;
vnum=varnum(dsid,VARIABLE_NM);
if vnum<1 then do;
/* should not happen as was also tested for above */
REASON_CD=cats("Variable (",VARIABLE_NM,") not found in &targetds");
putlog REASON_CD= dsid=;
call symputx('reason_cd',reason_cd,'l');
call symputx('nobs',_n_,'l');
output;
return;
end;
/* now we can get the type */
else vtype=vartype(dsid,vnum);
end;
/* closed list checks */
if GROUP_LOGIC not in ('AND','OR') then do;
@@ -136,15 +145,6 @@ data &outds;
call symputx('nobs',_n_,'l');
output;
end;
if upcase(VARIABLE_NM) not in
(%upcase(%mf_getvarlist(&targetds,dlm=%str(,),quote=SINGLE)))
then do;
REASON_CD="Variable "!!cats(variable_nm)!!" not in &targetds";
putlog REASON_CD= VARIABLE_NM=;
call symputx('reason_cd',reason_cd,'l');
call symputx('nobs',_n_,'l');
output;
end;
if OPERATOR_NM not in
('=','>','<','<=','>=','NE','GE','LE','BETWEEN','IN','NOT IN','CONTAINS')
then do;