Here is one way that does not require neither do loops or arrays.
data one;
input m1-m12;
cards;
0 1 4 0 0 0 0 0 0 0 0 0
1 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 5 0 6 0
;
run;
data two;
set one;
zero = sum(m1=0,m2=0,m3=0,m4=0,m5=0,m6=0,
m7=0,m8=0,m9=0,m10=0,m11=0,m12=0);
nonzero = 12 - zero;
put nonzero=;
run;
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!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.