Wednesday, July 14, 2010

Delete observations when all variabls are missing

It is a common question.

With the new function CMISS in 9.2, we can perform the task in ONLY one DATA step.
Please see the sample code at below:

data raw;
output; * obs with missing values;
a=1; b='2'; c=.;
output;
run;

data output;
set raw;
array aa {*} $ _character_;
array nn {*} _numeric_;

if cmiss(of _all_) = (dim(aa)+dim(nn)) then delete;
run;

No comments: