0
votes

I have a proc glm SAS code that drops about 260 observations, which is fine. However, I want to know how many observations it is using for each level of a certain variable.

How can I get a number of observations table, but listed by a variable rather than as a whole?

1

1 Answers

1
votes

Since you are excluding observations with one missing value, simply gain your result outside from the model (proc glm), into a simple dataset.

data want;
length misfl $1;
set have;
array mvars[*] var1 var2 var3;
do i=1 to dim(mvars);
if mvars[i]=. and misfl='' then misfl='Y';
end;
drop i;
run;

proc freq data=want noprint;
by byvar;
table misfl / out=frwant;
run;

A valid alternative, if you want to gain this result inside the model specification is the following. Since for excluded observations SAS won't calculate residuals (observations are dropped at the first step, they are not included in the estimation), you can output the residuals dataset adding into the model specification the statement

  output out=want00 r=resid;

then you will search for missing values (observation excluded --> estimation not done --> residuls not calculated) with a simple proc freq like I did in the previous code block.