SAS中文论坛

标题: 问两个小问题 [打印本页]

作者: shiyiming    时间: 2010-9-28 11:30
标题: 问两个小问题
1.
PROC IMPORT OUT= WORK.GENOTYPE DATAFILE= "M:\gene.xls" DBMS=EXCEL REPLACE;
     RANGE="Genotype";
     GETNAMES=YES;
     MIXED=NO;
     SCANTEXT=YES;
     USEDATE=YES;
     SCANTIME=YES;
RUN;
错误:12 个变量只读入10个。不过我好像意识到其中的原因了。还是问一下吧。
2.
data have;
input name $2. x1-x10;
datalines;
RT
11 12 13
14
11
16 16 10 18 19
FI
1 2 3 4 5
6
;
如何读取以上的数据成为如下所示:
name x1 x2 x3 x4 x5 x6 x7 x8 x9 x10
RT     11 12 13 14 11 16 16 10 18 19
FI        1   2   3  4   5   6   .   .   .   .
作者: shiyiming    时间: 2010-9-28 12:38
标题: Re: 问两个小问题
@@
作者: shiyiming    时间: 2010-9-28 13:56
标题: Re: 问两个小问题
@@怎么写呢?
[code:20fk1fj9]data have(keep=name x1-x10);
    length string $50;
    retain string;
    infile 'd:\jingju.txt' truncover end=last;
    input @;
    if anyalpha(_infile_) then do;
        temp=_infile_;
        if not missing(string) then do;
            _infile_=string;
            input name $2. x1-x10;
            output;
        end;
        string=temp;
    end;
    else string=catx(' ',string,_infile_);
    if last then do;
        _infile_=string;
        input name $2. x1-x10;
        output;
    end;
run;[/code:20fk1fj9]
作者: shiyiming    时间: 2010-9-28 21:16
标题: Re: 问两个小问题
If it is under UNIX then echo $(cat file.txt) with PIPE and @@;
if it is under windows. please use ultraedit to convert to an one line file and @@;
作者: shiyiming    时间: 2010-9-29 11:58
标题: Re: 问两个小问题
多谢多谢。二位的解答好像都不是很容易看得懂的。容我慢慢琢磨琢磨。JingJu




欢迎光临 SAS中文论坛 (https://mysas.net/forum/) Powered by Discuz! X3.2