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;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.