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;
Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.
Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.
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.