[問題] SAS從EXCEL讀入之資料有"."如何處理?
第一次發文
若無意觸犯規則請海涵
爬了以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
→
03/15 09:12, , 1F
03/15 09:12, 1F
→
03/15 09:12, , 2F
03/15 09:12, 2F
→
03/15 09:13, , 3F
03/15 09:13, 3F
討論串 (同標題文章)
以下文章回應了本文:
完整討論串 (本文為第 1 之 2 篇):