c
d e
------------------------------------------------------
1 2
3
4 5
想导入到SAS里面,该怎么INFILE 啊,结果应该是
a b c d e
1 2 3 4 5作者: shiyiming 时间: 2008-7-23 11:10 标题: Re: 求助,文本文件导入 用 input 语句中的指针控制选项 (Pointer Controls option) 就可以跨行读取。
具体的细节看联机文档。作者: shiyiming 时间: 2008-7-23 15:55 标题: Re: 求助,文本文件导入 但是如果文本文件是这样的呢
The SAS System
a b
c
d e
------------------------------------------------------
1 2
3
4 5
6 7
8
9 1
The SAS System
a b
c
d e
------------------------------------------------------
1 3
5
7 9
2 4
6
8 0作者: shiyiming 时间: 2008-7-23 23:28 标题: 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;
input #8 a b
#10 c
# 11 d e ;
output;
input a b //
c /
d e;
output;
run;
proc print data=firstqtr;
run;作者: shiyiming 时间: 2008-7-27 18:30 标题: Re: 求助,文本文件导入 但是如果文本文档是这样的呢?
[code:2hepuv21]The SAS System
a b
c
d e
------------------------------------------------------
1 2
3
4 5
6 7
8
9 1
The SAS System
a b
c
d e
------------------------------------------------------
1 3
5
7 9
2 4
6
8 0
The SAS System
a b
c
d e
------------------------------------------------------
2 4
6
8 7
[/code:2hepuv21]作者: shiyiming 时间: 2008-7-28 23:26 标题: Re: 求助,文本文件导入 傻,为什么不存在excel里导入呢?还用这么过时的txt?