Hi all SAS Users,
I saw the difference in SAS order of code written and from the log as be low
My code
data filter;
set var_cal;
where (n(ajexdi,prccd_abs_,trfd)=3 or n(prccd_abs_,prchd,prcld)=3)
and
prccd_abs_ > 0
and
tpci='0'
and
(prcstd=3 or (prcstd=4 and LOC='CAN') or prcstd=10)
and
(input(SIC, 4.) not in (4900:4949, 6000:6999))
and
(raw_return<200)
;
run;
The log is as below
NOTE: There were 20150398 observations read from the data set WORK.VAR_CAL. WHERE ((N(ajexdi, prccd_abs_, trfd)=3) or (N(prccd_abs_, prchd, prcld)=3)) and (prccd_abs_>0) and (tpci='0') and (prcstd in (3, 10) or ((prcstd=4) and (LOC='CAN'))) and (raw_return<200) and ((INPUT(SIC, 4.) not = INT(INPUT(SIC, 4.))) or not ((INPUT(SIC, 4.)>=4900 and INPUT(SIC, 4.)<=4949) or (INPUT(SIC, 4.)>=6000 and INPUT(SIC, 4.)<=6999)));
As we can see from the code, raw_return <200 is at the last condition while in the log, the raw_return condition is not the last condition, it is quite strange to me.
Could you please help me to sort it out?
Warm regards.
There is nothing wrong with the WHERE statement in the log. The reason for the reordering is SAS has to interpret your use of ranges - (4900:4949, 6000:6999) so has chosen to put the translation at the end of the WHERE. The order of the WHERE components won't affect the result.
There is nothing wrong with the WHERE statement in the log. The reason for the reordering is SAS has to interpret your use of ranges - (4900:4949, 6000:6999) so has chosen to put the translation at the end of the WHERE. The order of the WHERE components won't affect the result.
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.