The NLEVELS of Proc FREQ does not exactly do what you need. Had another go using the Hash object in the DATA Step.
Have a look
data have;
infile cards dlm="," dsd;
input
RAWREG
PVPRISM $
OVRIDE3 $
DAYS
;
cards;
01,0939,,408
,0943,,379
09,0029,,170
11,0948,,
,0948,,59
04,6108,,57
06,0993,,59
06,6111,,59
06,0993,,220
04,0901,,59
,,3,
;
data _null_;
set have end=last;
array _xchar{*} _character_;
array _xnum{*} _numeric_;
if _n_ = 1 then do;
length
_colName $ 32
_nMiss 8
_n 8
;
declare hash hmiss( ordered: "Y");
hmiss.defineKey("_colName");
hmiss.defineData("_colName", "_n", "_nMiss");
hmiss.defineDone();
end;
do i = 1 to dim(_xchar);
_nMiss=0;
_n=0;
_colName = vname( _xchar{i} );
_rc = hmiss.find();
_nMiss + (missing(_xchar{i}) = 1);
_n + (missing(_xchar{i}) = 0);
if _rc = 0 then do;
hmiss.replace();
end;
else do;
hmiss.add();
end;
end;
do i = 1 to dim(_xnum);
_nMiss=0;
_n=0;
_colName = vname( _xnum{i} );
_rc = hmiss.find();
_nMiss + (missing(_xnum{i}) = 1);
_n + (missing(_xnum{i}) = 0);
if _rc = 0 then do;
hmiss.replace();
end;
else do;
hmiss.add();
end;
end;
if last = 1 then do;
hmiss.output(dataset: "hashmiss");
end;
run;
proc print data=hashmiss;
run;
proc print data=have;
run;
Bruno
... View more