Would you mind letting me know the difference of those two codes? I really don't know functionally what the difference is / what makes the difference of the 2 observations.
1)
data cleandata36;
set cert.input36;
if upcase(Group) in ('A', 'B') then do;
end;
run;
proc contents data=cleandata36;
run;
2)
data cleandata36;
set cert.input36;
if upcase(Group) in ('A', 'B');
run;
proc contents data=cleandata36;
run;
"Then do" is one difference. So, the only one difference of two codes is 'observation'
1)
Observations
| 5000 |
2)
Observations
| 4992 |
Thank you.
The IF Statement: Subsetting causes the data step (if the condition does not resolve to true) to immediately return to the top, skipping any remaining statements and starting the next iteration. This also means that the implicit OUTPUT at the end of the data step (if no explicit OUTPUT was coded) is not performed.
The "normal" IF does not do this, and therefore all observations in your example are kept.
Nearly 200 sessions are now available on demand with the SAS Innovate Digital Pass.
Explore Now →SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.