g*******y 发帖数: 380 | 1 Hi,all
I have a question as below:
I want count the total number of non-missing value for several variables by
year.
Suppose the dataset looks like this:
year varA varB varX varP....
I know I can do proc freq...; tables year*varA;
or proc sql;.. count(varA) as..;group by year;...
But how can I do it for several variables at once and get a single table?
Thank you in advance. |
g*******y 发帖数: 380 | 2 I got it. Just use proc means. Sorry to bother others, I was scared that I
might need use array or macro.
Thank you anyway. |
p********a 发帖数: 5352 | 3 It is easier to use Proc sql; select Nmiss(var1),Nmiss(var2).... |
p********a 发帖数: 5352 | 4 or just N(var1),N(var2) for non-missing |
g*******y 发帖数: 380 | 5 Thank you very much! BZ is always so nice.
I just have one more question:
It works well for my data b/c I only interested in 6 variables.
What if I have hundreds of variables and want count non-missing value for
each one of them? How can I avoid using a long list of variables? |
p********a 发帖数: 5352 | 6 THen you have to use macro. It is something like select variable names from
the dictionary tables and then output them into macro variables |