
Rick A. answered 04/21/19
Experienced SAS Professional
/* create test data */
data raa;
input city $ st $ name $ sex $ age;
datalines;
Boston MA George M 59
Atlanta GA Jan F 62
Chicago IL Daniel M 27
;
run;
data blank;
city=''; st=' '; name=''; sex=' '; age=.; output;
city=''; st='CA'; name=''; sex=' '; age=.; output;
city=''; st=' '; name=''; sex=' '; age=30; output;
city=''; st=' '; name=''; sex='M'; age=.; output;
run;
data raa;
set raa blank;
run;
/* remove records with all blank/missing value fields */
data _null_;
set sashelp.vcolumn end=eof;
where libname = 'WORK' and memname = 'RAA';
x+1;
call symputx('field'||left(_n_), name);
call symputx('type'||left(_n_), type);
if eof then call symputx('totfields', x);
run;
%macro final(infile=,outfile=);
data &outfile(drop=nonblank);
set &infile;
nonblank=0;
%do i=1 %to &totfields;
%if &&type&i eq char %then %do;
if &&field&i ne '' then nonblank=1;
%end;
%else %do;
if &&field&i ne . then nonblank=1;
%end;
%end;
if nonblank;
run;
%mend final;
/* file raa will have 7 records and file raa2 will have 6 records */
%final(infile=raa,outfile=raa2);