|
|
地板

楼主 |
发表于 2008-7-23 23:28:03
|
只看该作者
Re: 求助,文本文件导入
一个笨办法,丢人了:(我自己看了都想吐)
[code:16ofvx09]
data a;
length a $1000;
infile "c\m.txt" length=len;
input a $varying1000. len;
if not missing(a);
run;
data a(drop=a);
length tmp $1000;
set a end=last;
retain tmp maxn;
if _n_=1 then do;tmp=' ';maxn=0;end;
else if index(a,'-') or index(a,'SAS') then do;n=countc(trim(tmp),'');output;tmp='';maxn=max(n,maxn);end;
else tmp=catx('',of tmp a);
if last then do;n=countc(trim(tmp),'');output;maxn=max(n,maxn);call symput('maxn',maxn);end;
run;
data a(drop=tmp maxn i n);
set a;
array aa{%eval(&maxn.+1)} $;
do i=1 to n+1;
aa(i)=scan(tmp,i,'');
end;
run;
[/code:16ofvx09] |
|