作者cbm (椎名云望)
站内Statistics
标题[问题] SAS从EXCEL读入之资料有"."如何处理?
时间Mon Mar 14 22:46:35 2011
第一次发文
若无意触犯规则请海涵
爬了以SAS为搜寻的文章
有找到类似於我的问题但是却不大一样的结果
无奈之下才PO文发问
==================================
我从EXCEL读入的资料类似下面
1 . . 40.790 -0.75 -0.25 . . .
2 . . -45.143 0.07 0.11 . . .
3 . . -73.430 1.03 1.69 . . .
4 . . -52.929 0.14 0.13 . . .
5 . . -52.213 -0.13 -0.03 . . .
16 . . 72.148 -0.49 -0.41 . . .
17 . . 11.985 -1.95 -1.53 . . .
18 . . 48.482 -1.15 -0.75 0.29 . .
19 . . 85.017 -0.30 0.10 -5.98 . .
34 . -37.143 -16.406 -0.50 -0.41 -1.65 . .
35 . -51.948 -21.528 -2.94 -3.05 0.89 . .
36 . -47.269 -20.670 -0.50 -0.80 0.49 . .
37 -40.524 -40.617 -24.098 -0.93 -0.72 -0.98 . .
38 -17.575 6.44 12.168 1.44 1.57 -2.84 . .
39 -33.706 2.355 11.192 1.21 1.13 -0.89 . .
40 -11.308 20.825 31.634 -0.28 0.07 0.71 0.37 .
41 0.489 28.015 43.969 -0.35 -1.37 1.24 0.79 .
================================
有文章好像有提到"."是missing value的概念
不过当我写
PROC IMPORT OUT= WORK.ttb
DATAFILE= "D:\sas\TBB201003.xls"
DBMS=EXCEL REPLACE;
RANGE="Sheet1$";
GETNAMES=YES;
MIXED=NO;
SCANTEXT=YES;
USEDATE=YES;
SCANTIME=YES;
RUN;
proc print ; run ;
proc plot ; plot y1*x1 ; plot y2*x1 ; plot y3*x1 ; plot y4*x1 ; run ;
proc plot ; plot y1*x2 ; plot y2*x2 ; plot y3*x2 ; plot y4*x2 ; run ;
proc plot ; plot y1*x3 ; plot y2*x3 ; plot y3*x3 ; plot y4*x3 ; run ;
proc plot ; plot y1*x4 ; plot y2*x4 ; plot y3*x4 ; plot y4*x4 ; run ;
proc means ; var x1 x2 x3 x4 y1 y2 y3 y4 ; run ;
proc corr ; var x1 x2 x3 x4 y1 y2 y3 y4 ; run ;
有点的部分 就会跑出
16 proc means ; var x1 x2 x3 x4 y1 y2 y3 y4 ; run ;
ERROR: Variable x4 in list does not match type prescribed for this list.
ERROR: Variable y1 in list does not match type prescribed for this list.
ERROR: Variable y2 in list does not match type prescribed for this list.
ERROR: Variable y3 in list does not match type prescribed for this list.
ERROR: Variable y4 in list does not match type prescribed for this list.
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE MEANS used (Total process time):
real time 0.02 seconds
cpu time 0.00 seconds
17 proc corr ; var x1 x2 x3 x4 y1 y2 y3 y4 ; run ;
ERROR: Variable x4 in list does not match type prescribed for this list.
ERROR: Variable y1 in list does not match type prescribed for this list.
ERROR: Variable y2 in list does not match type prescribed for this list.
ERROR: Variable y3 in list does not match type prescribed for this list.
ERROR: Variable y4 in list does not match type prescribed for this list.
造成无法运算的结果
我把语法改成
proc means ; run ;
proc corr ; run ;
跑出来结果亦同
可以请问该如何写才能将 "."的资料跳过进行运算吗
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 218.172.235.212
1F:→ kingbee:import 需要再打个mixed=yes 03/15 09:12
2F:→ kingbee:excel的missing 和SAS的表示方法正好相反 03/15 09:12
3F:→ kingbee:所以先把变项都转换成文字型态 进入SAS 再转成数字 03/15 09:13