*create fake data;
data class;
set sashelp.class;
if age=14 then
call missing(height, weight, sex);
if name='Alfred' then
call missing(sex, age, height);
label age="Fancy Age Label";
run;
*create missing format;
proc format;
value $ missfmt ' '="Missing" other="Not Missing";
value nmissfmt .="Missing" other="Not Missing";
run;
proc freq data=class;
table _all_ / missing;
format _numeric_ nmissfmt. _character_ $missfmt.;
run;
It is a more complicated solution but it's also more flexible. An often required statistic is what percentage of data is missing, not just the Ns. Or in a format that can be included in a journal like N(%) 8(25%).
There's many ways to count missing and you'd find even in my GitHub pages several ways to count missing. This is another way that generalizes to almost any data set.
... View more