I am trying to categorized data based on what the last two characters are in a variable rand1=rand('uniform');
rand2=rand('uniform');
if rand1>0.90 Then do;
if (POIDS>0 and substr(USAGE,2,2) IN('20','21')) then do;
if rand2>0.5 then RadiusSurcharge="A";
ELSE RadiusSurcharge="B";
end;
if (POIDS=0 and substr(USAGE,2,2) IN('20','21')) then do;
if rand2>0.5 then RadiusSurcharge="C";
else RadiusSurcharge="D";
end;
end;
if rand1>0.90 then do;
if (POIDS>0 and substr(USAGE,2,2) NE('20','21')) then do;
if rand2>0.5 then RadiusSurcharge="E";
else RadiusSurcharge="F";
end;
if (POIDS=0 and substr(USAGE,2,2) NE('20','21')) then do;
if rand2<0.333 then RadiusSurcharge="G";
else if rand2>0.333 and rand2<0.666 then do RadiusSurcharge="H";
else RadiusSurcharge="I";
end;
end;
end; The top half, I use IN function so that the obs that does contain '20' or '21' gets assigned other variables accordinly For the second half I am trying to use NE so that the observations that don't contain '20' or '21' but i keep getting the following errors, if (POIDS>0 and substr(USAGE,2,2) NE('20','21')) then do;
_
388
200
ERROR 388-185: Expecting an arithmetic operator.
ERROR 200-322: The symbol is not recognized and will be ignored. Please advise!
... View more