mirror of
https://github.com/sasjs/core.git
synced 2026-01-02 07:10:06 +00:00
chore: updating all.sas
This commit is contained in:
83
all.sas
83
all.sas
@@ -6377,15 +6377,14 @@ drop table &ds1, &ds2;
|
|||||||
/**
|
/**
|
||||||
* Sanitise the values based on valid value lists, then strip out
|
* Sanitise the values based on valid value lists, then strip out
|
||||||
* quotes, commas, periods and spaces.
|
* quotes, commas, periods and spaces.
|
||||||
* Only numeric values should remain
|
|
||||||
*/
|
*/
|
||||||
%local reason_cd nobs;
|
%local reason_cd nobs;
|
||||||
%let nobs=0;
|
%let nobs=0;
|
||||||
data &outds;
|
data &outds;
|
||||||
/*length GROUP_LOGIC SUBGROUP_LOGIC $3 SUBGROUP_ID 8 VARIABLE_NM $32
|
/*length GROUP_LOGIC SUBGROUP_LOGIC $3 SUBGROUP_ID 8 VARIABLE_NM $32
|
||||||
OPERATOR_NM $10 RAW_VALUE $4000;*/
|
OPERATOR_NM $10 RAW_VALUE $4000;*/
|
||||||
set &inds;
|
set &inds end=last;
|
||||||
length reason_cd $4032 vtype $1 vnum dsid 8 tmp $4000;
|
length reason_cd $4032 vtype vtype2 $1 vnum dsid 8 tmp $4000;
|
||||||
drop tmp;
|
drop tmp;
|
||||||
|
|
||||||
/* quick check to ensure column exists */
|
/* quick check to ensure column exists */
|
||||||
@@ -6401,7 +6400,8 @@ data &outds;
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
/* need to open the dataset to get the column type */
|
/* need to open the dataset to get the column type */
|
||||||
dsid=open("&targetds","i");
|
retain dsid;
|
||||||
|
if _n_=1 then dsid=open("&targetds","i");
|
||||||
if dsid>0 then do;
|
if dsid>0 then do;
|
||||||
vnum=varnum(dsid,VARIABLE_NM);
|
vnum=varnum(dsid,VARIABLE_NM);
|
||||||
if vnum<1 then do;
|
if vnum<1 then do;
|
||||||
@@ -6411,11 +6411,19 @@ data &outds;
|
|||||||
call symputx('reason_cd',reason_cd,'l');
|
call symputx('reason_cd',reason_cd,'l');
|
||||||
call symputx('nobs',_n_,'l');
|
call symputx('nobs',_n_,'l');
|
||||||
output;
|
output;
|
||||||
return;
|
goto endstep;
|
||||||
end;
|
end;
|
||||||
/* now we can get the type */
|
/* now we can get the type */
|
||||||
else vtype=vartype(dsid,vnum);
|
else vtype=vartype(dsid,vnum);
|
||||||
end;
|
end;
|
||||||
|
else do;
|
||||||
|
REASON_CD=cats("Could not open &targetds");
|
||||||
|
putlog REASON_CD= dsid=;
|
||||||
|
call symputx('reason_cd',reason_cd,'l');
|
||||||
|
call symputx('nobs',_n_,'l');
|
||||||
|
output;
|
||||||
|
stop;
|
||||||
|
end;
|
||||||
|
|
||||||
/* closed list checks */
|
/* closed list checks */
|
||||||
if GROUP_LOGIC not in ('AND','OR') then do;
|
if GROUP_LOGIC not in ('AND','OR') then do;
|
||||||
@@ -6450,15 +6458,40 @@ data &outds;
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
/* special missing logic */
|
/* special missing logic */
|
||||||
if vtype='N'
|
if vtype='N' & OPERATOR_NM in ('=','>','<','<=','>=','NE','GE','LE') then do;
|
||||||
and OPERATOR_NM in ('=','>','<','<=','>=','NE','GE','LE')
|
if cats(upcase(raw_value)) in (
|
||||||
and cats(upcase(raw_value)) in (
|
|
||||||
'.','.A','.B','.C','.D','.E','.F','.G','.H','.I','.J','.K','.L','.M','.N'
|
'.','.A','.B','.C','.D','.E','.F','.G','.H','.I','.J','.K','.L','.M','.N'
|
||||||
'.N','.O','.P','.Q','.R','.S','.T','.U','.V','.W','.X','.Y','.Z','._'
|
'.N','.O','.P','.Q','.R','.S','.T','.U','.V','.W','.X','.Y','.Z','._'
|
||||||
)
|
)
|
||||||
then do;
|
then do;
|
||||||
/* valid numeric - exit data step loop */
|
/* valid numeric - exit data step loop */
|
||||||
return;
|
return;
|
||||||
|
end;
|
||||||
|
else if subpad(upcase(raw_value),1,1) in (
|
||||||
|
'A','B','C','D','E','F','G','H','I','J','K','L','M','N'
|
||||||
|
'N','O','P','Q','R','S','T','U','V','W','X','Y','Z','_'
|
||||||
|
)
|
||||||
|
then do;
|
||||||
|
/* check if the raw_value contains a valid variable NAME */
|
||||||
|
vnum=varnum(dsid,subpad(raw_value,1,32));
|
||||||
|
if vnum>0 then do;
|
||||||
|
/* now we can get the type */
|
||||||
|
vtype2=vartype(dsid,vnum);
|
||||||
|
/* check type matches */
|
||||||
|
if vtype2=vtype then do;
|
||||||
|
/* valid target var - exit loop */
|
||||||
|
return;
|
||||||
|
end;
|
||||||
|
else do;
|
||||||
|
REASON_CD=cats("Compared Type (",vtype2,") is not (",vtype,")");
|
||||||
|
putlog REASON_CD= dsid=;
|
||||||
|
call symputx('reason_cd',reason_cd,'l');
|
||||||
|
call symputx('nobs',_n_,'l');
|
||||||
|
output;
|
||||||
|
goto endstep;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
/* special logic */
|
/* special logic */
|
||||||
@@ -6480,6 +6513,32 @@ data &outds;
|
|||||||
if vtype='N' then do i=1 to countc(raw_value1, ',')+1;
|
if vtype='N' then do i=1 to countc(raw_value1, ',')+1;
|
||||||
tmp=scan(raw_value1,i,',');
|
tmp=scan(raw_value1,i,',');
|
||||||
if cats(tmp) ne '.' and input(tmp, ?? 8.) eq . then do;
|
if cats(tmp) ne '.' and input(tmp, ?? 8.) eq . then do;
|
||||||
|
if OPERATOR_NM ='BETWEEN' and subpad(upcase(tmp),1,1) in (
|
||||||
|
'A','B','C','D','E','F','G','H','I','J','K','L','M','N'
|
||||||
|
'N','O','P','Q','R','S','T','U','V','W','X','Y','Z','_'
|
||||||
|
)
|
||||||
|
then do;
|
||||||
|
/* check if the raw_value contains a valid variable NAME */
|
||||||
|
/* is not valid syntax for IN or NOT IN */
|
||||||
|
vnum=varnum(dsid,subpad(tmp,1,32));
|
||||||
|
if vnum>0 then do;
|
||||||
|
/* now we can get the type */
|
||||||
|
vtype2=vartype(dsid,vnum);
|
||||||
|
/* check type matches */
|
||||||
|
if vtype2=vtype then do;
|
||||||
|
/* valid target var - exit loop */
|
||||||
|
return;
|
||||||
|
end;
|
||||||
|
else do;
|
||||||
|
REASON_CD=cats("Compared Type (",vtype2,") is not (",vtype,")");
|
||||||
|
putlog REASON_CD= dsid=;
|
||||||
|
call symputx('reason_cd',reason_cd,'l');
|
||||||
|
call symputx('nobs',_n_,'l');
|
||||||
|
output;
|
||||||
|
goto endstep;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
REASON_CD='Non Numeric value provided';
|
REASON_CD='Non Numeric value provided';
|
||||||
putlog REASON_CD= OPERATOR_NM= raw_value= raw_value1= ;
|
putlog REASON_CD= OPERATOR_NM= raw_value= raw_value1= ;
|
||||||
call symputx('reason_cd',reason_cd,'l');
|
call symputx('reason_cd',reason_cd,'l');
|
||||||
@@ -6512,6 +6571,8 @@ data &outds;
|
|||||||
output;
|
output;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
endstep:
|
||||||
|
if last then rc=close(dsid);
|
||||||
run;
|
run;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user