How to delete rows with missing values in every column?
Is there any simple way?
Thanks
You need to provide some samples. for one of the simplest senarios:
data have;
input a1-a4;
cards;
1 2 3 4
. . . .
5 6 7 8
;
data want;
set have;
if n(of a1-a4);
run;
proc print;run;
Regards,
Haikuo
You need to provide some samples. for one of the simplest senarios:
data have;
input a1-a4;
cards;
1 2 3 4
. . . .
5 6 7 8
;
data want;
set have;
if n(of a1-a4);
run;
proc print;run;
Regards,
Haikuo
I know there are better solutions out there, but for a more general approach, this is what I came up:
data have;
input a1-a4;
cards;
1 2 3 4
. . . .
5 6 7 8
. 1 . .
;
proc sql;
select count(name) into :names from dictionary.coluMNs
where libname='WORK' AND MEMNAME='HAVE';
QUIT;
data want;
set have;
if CMISS(OF _ALL_)<&NAMES;
run;
proc print;run;
In that case, there is an old fashion way hopefully to meet your need:
data have;
input a1-a4 (c1-c3) ($);
cards;
1 2 3 4 a b c
. . . . . . .
5 6 7 8 . . f
. 1 . . . . .
;
data want;
set have;
array c _character_;
if n(of _numeric_)=0 then
do over c;
if not missing(c) then
do;
output;
return;
end;
end;
else output;
run;
proc print;run;
Regards,
Haikuo
OH. Hope you could have SAS 9.2 as fast as you can.
data have; input name $ a1-a4; cards; q 1 2 . 4 . . . . . w 5 6 7 8 ; run; options missing=' '; data want; set have; if missing(cats(of _all_)) then delete; run;
Ksharp
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.