Hi, I have a dataset like the following: Company VAR1 VAR2 VAR3 VAR4 VAR5 Company1 0 28 0 0 0 Company2 4 0 0 12 19 Company3 7 0 6 55 25 Company4 8 0 23 0 7 Company5 10 15 10 34 52 The dataset has a total of 160 variables, of which I want to find summary statistics for each variable. However, I first want to determine the number of non-zero observations for each variable. To do this with a small number of variables I would probably do the following: Proc sql; create table want as select *, sum(case when VAR1 ne 0 then 1 else 0 end) as count1, sum(case when VAR2 ne 0 then 1 else 0 end) as count2 from have; Quit; However, this is code is not as useful when I have 160 variables I want to get counts for. Is there an easier way this can be done? I assume this can be done with proc freq or proc summary, but am not very familiar with these procs. Keep in mind I also want to keep the values for each variable as I want to eventually gather summary statistics for each variable. Eventually I would want my final dataset to look something like this: Variable Number of non-zero observations for each variable Min Max Mean Median Var1 4 Var2 2 Var3 3 Var4 3 Var5 4 Var6 ...etc. Var7 ...etc. I can probably handle the transposing and re-arranging the data from a proc means output, so I was mostly wondering what the best way to get the count of non-zero observations for each variable. Thank you.
... View more