How do I count for each variable in PROC REPORT porcedure? I have tried n, proc means
so, here is my final dataset:
x1. x2 x3. x4
1 0. 1. 1
0. 0. 1. 1
1. 1. 0. 1
1. 0. 0. 0
1. 0. 0. 0
I need to count how many ones for each variable. and produce the proc report as:
x1. x2. x3. x4
n. 4. 1. 2. 3
data have;
input x1 x2 x3 x4;
cards;
1 0. 1. 1
0. 0. 1. 1
1. 1. 0. 1
1. 0. 0. 0
1. 0. 0. 0
;
proc report data=have nowd;
column x x1 x2 x3 x4;
define x/computed ' ';
define x1/analysis sum;
define x2/analysis sum;
define x3/analysis sum;
define x4/analysis sum;
compute x/character length=2;
x='n';
endcomp;
run;
Thank you for the tip and help. It worked. And, when I add DISPLAY variables in DEFINE statement that sum goes away.
How can I display my variables. Thanks!
That was supposed to do .
What do you want ? Post your output .
Thanks for the quick reply!
I have added "DISPLAY variables" after "analysis options" and it did not worked. But, when I add DISPLAY before the analysis Then it works. It displays varibles ans the sum. Thanks so much
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 lock in 2025 pricing—just $495!