SAS中文论坛

 找回密码
 立即注册

扫一扫,访问微社区

查看: 1072|回复: 1
打印 上一主题 下一主题

【急】SAS导入excel数据时 对缺失数据的处理

[复制链接]

49

主题

76

帖子

1462

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1462
楼主
 楼主| 发表于 2012-3-31 23:09:24 | 只看该作者

【急】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;
回复 支持 反对

使用道具 举报

49

主题

76

帖子

1462

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1462
沙发
 楼主| 发表于 2012-4-4 14:17:42 | 只看该作者

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.
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|小黑屋|手机版|Archiver|SAS中文论坛  

GMT+8, 2025-5-7 00:40 , Processed in 0.070231 second(s), 21 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表