hi ... here's an idea based on a recent posting by Ksharp on how to use PROC SQL to find variables with all missing data (should work for any data set since SQL does all the work of finding the variable names and doing the counting for you) ... * some data with missing values; data class; set sashelp.class; if ranuni(0) le 0.7 then call missing(age,name); else if ranuni(0) le 0.4 then call missing(height); call missing (weight); run; * take a look at the amount of missing ; proc print data=class; run; * as suggested by Ksharp ... use NMISS to count missing values; proc sql noprint; select cat('nmiss(',strip(name),') as ',name) into :list separated by ',' from dictionary.columns where libname='WORK' and memname='CLASS'; create table temp as select &list from class; select count(*) into :nobs from class; quit; * make a report; data report; set temp; array x{*} _numeric_; do i=1 to dim(x); var = vname(x(i)); miss = x(i); pctmiss = round(100*miss / &nobs, 0.1); output; end; keep var miss pctmiss; run; * look at the results; proc print data=report run; ps You can also look at "An Easy Route to a Missing Data Report with ODS+PROC FREQ+A Data Step" ( http://www.lexjansen.com/nesug/nesug11/ds/ds12.pdf ) though if I were writing that now, I'd replace the use of ODS and PROC FREQ with SQL as suggested by Ksharp (a LOT less programming in the subsequent data step).
... View more