比如,
1, delete 第3和5行
2, or delete v2和v3列?
3, position and type of variables (both char and num/date/time) and no. of records are not fixed... <!-- s:D --><img src="{SMILIES_PATH}/icon_biggrin.gif" alt=":D" title="Very Happy" /><!-- s:D -->
data missdata;
input n1 n2 n3 n4 n5 n6 n7 n8 c1 $ c2 $ c3 $ c4 $;
sumnum=sum(of _numeric_);
sumchar=COMPRESS(COMPBL(KSTRCAT(OF _character_)));
datalines;
1 . 1 . 1 . 1 4 a . c .
1 . . . 2 . . 5 e . g h
1 . 1 . 3 . . 6 . . k l
3 . 5 . 8 . 4 7 f . y z
. . . . . . . . . . . .
6 . 5 . 8 . . 7 f . y z
;
data tempdata;
set missdata;
if sumnum=. and sumchar='' then delete;
drop sumnum sumchar;
run;
proc sql noprint;
select name, put(count(name),5.-L) into :clist separated by ' ' , :charct
from dictionary.columns
where libname=upcase("&lib") and memname=upcase("&mem") and type='char';
select name, put(count(name),5.-L) into :nlist separated by ' ', :numct
from dictionary.columns
where libname=upcase("&lib") and memname=upcase("&mem") and type='num';
quit;
do i=1 to dim(num_vars);
if num_vars(i) ne . then num_miss(i)='non-miss';
end;
do i=1 to dim(char_vars);
if char_vars(i) ne '' then char_miss(i)='non-miss';
end;
if finished then do;
do i= 1 to dim(num_vars);
if num_miss(i) = 'missing' then list=trim(list)||' '||trim(vname(num_vars(i)));
end;
do i= 1 to dim(char_vars);
if char_miss(i) = 'missing' then list=trim(list)||' '||trim(vname(char_vars(i)));
end;
call symput('mlist',list);
end;
run;
data notmiss;
set tempdata;
drop &mlist;
run;
proc print;
run;[/code:01c28]