|
5#

楼主 |
发表于 2011-4-26 02:37:20
|
只看该作者
Re: 请教一个DATA步的问题
[code:29j9wx66]data _null_;
set had end =Eof;
array _c[*] _character_; array _tc[100] $1 _temporary_;
array _n[*] _numeric_ ; array _tn[100] _temporary_;
do i =1 to dim(_c);
if _tc[i] ne 'c' then if not missing(_c[i]) then do;
c ++1; _tc[i] ='c'; call symputx(cats('c', c), vname(_c[i]));
end;
end;
do i =1 to dim(_n);
if _tn[i] ne 1 then if not missing(_n[i]) then do;
n ++1; _tn[i] =1 ; call symputx(cats('n', n), vname(_n[i]));
end;
end;
if Eof then do;
call symputx('n', n);
call symputx('c', c);
end;
run;
%macro keepem;
%do i =1 %to &c; &&c&i. %end;
%do i =1 %to &n; &&n&i. %end;
%mend keepem;
data have;
set had;
keep %keepem;
run;[/code:29j9wx66] |
|