Hi, I have a very simple question;
in case I am using multiple variables in var statement of proc means and I want to calculate average for all of them based on non zero values then How should approach the where statement in the proc means ?
Hi,
Please note that the post is 4 years old - start a new post. In answer to your question, why not go with Data _null_;'s suggestion of using arrays:
data have;
a=1; b=4; c=0; d=3; output;
a=4; b=4; c=1; d=5; output;
run;
data inter (keep=res1-res4);
set have;
array var{4} a b c d;
array res{4};
do i=1 to 4;
if var{i}=0 then res{i}=.;
else res{i}=var{i};
end;
run;
proc means data=inter;
var res1-res4;
output out=test;
run;
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and save with the early bird rate—just $795!
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.