SAS中文论坛

标题: 【急】SAS导入excel数据时 对缺失数据的处理 [打印本页]

作者: shiyiming    时间: 2012-3-31 23:09
标题: 【急】SAS导入excel数据时 对缺失数据的处理
excel表格中共有4个变量,每个变量有226个观测值。用import将excel导入sas, proc print可以输出4组变量值,但用proc corr计算相关系数时,出现错误ERROR: Variable list empty.
自己分析原因估计是sas在读入数据时,由于这4个变量的前8个观测值都为缺失,因此不能读入。

求高手分析求解。下面是SAS code

PROC IMPORT OUT= WORK.correlation
            DATAFILE= "D:\work\Correlation.xls"
            DBMS=EXCEL REPLACE;
     RANGE="Sheet1$";
     GETNAMES=YES;
     MIXED=NO;
     SCANTEXT=YES;
     USEDATE=YES;
     SCANTIME=YES;
RUN;

data correlation1;
set correlation;
run;

proc print data=correlation1;
run;

proc corr data=correlation1;
run;
作者: shiyiming    时间: 2012-4-4 14:17
标题: Re: 【急】SAS导入excel数据时 对缺失数据的处理
you should change the MIXED= option to YES. the MIXED option converts numeric values to character values if a column display numeric and character values(cells), SAS scans only the first 8 rows of EXCEL column to determine the column is numeric or character. Since your first 8 observations are blank, SAS picks them as character, but there are numeric cells later, then those will be set to blank.




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