data groups;
set cert.input48;
if upcase(cvar) in ('A','B','C','D','E','F','G') then group=1;
else if upcase(cvar) in ('H','I','J','K','L','M','N') then group=2;
else group=3;
numy=input(y,10.);
run;
proc means data=groups mean maxdec=0;
var numy;
where group=2;
run;
where group=2 , why is not using 'if' ?
You can't use IF to subset your dataset within PROC MEANS. You can only use WHERE.
In DATA steps, using WHERE on the SET statement usually allows for faster processing by only reading in observations that fit the condition. Using IF requires reading in all observations and then subsetting based on that condition.
You can't use IF to subset your dataset within PROC MEANS. You can only use WHERE.
In DATA steps, using WHERE on the SET statement usually allows for faster processing by only reading in observations that fit the condition. Using IF requires reading in all observations and then subsetting based on that condition.
You can only use if in data step. Proc, you have to use where statement.
@tarheel13 wrote:
You can only use if in data step. Proc, you have to use where statement.
I might modify that "only use IF to subset data in a data step".
A few procedures have places where "IF" is used for things other than subsetting data.
Thank you for your help.
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.