Re: [問題] SAS從EXCEL讀入之資料有"."如何處理?

看板Statistics作者 (what matters)時間15年前 (2011/03/15 06:48), 編輯推噓1(100)
留言1則, 1人參與, 最新討論串2/2 (看更多)
※ 引述《cbm (椎名雲望)》之銘言: : 有文章好像有提到"."是missing value的概念 沒錯 : 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. 錯誤是因為y1-y4和x4在匯入時被存成character variables 理所當然characters沒辦法被運算 解決方式之一是把這些轉換存成numeric variables DATA work.new_ttb; SET work.ttb; n_y1=INPUT(y1,best8.); n_y2=INPUT(y2,best8.); n_y3=INPUT(y3,best8.); n_y4=INPUT(y4,best8.); n_x4=INPUT(x4,best8.); RUN; PROC MEANS DATA=work.new_ttb; VAR n_y1 n_y2 n_y3 n_y4 n_x4; RUN; PROC CORR DATA=work.new_ttb; VAR n_y1 n_y2 n_y3 n_y4 n_x4; RUN; -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 66.57.62.246

03/15 23:06, , 1F
謝謝你的分享^^
03/15 23:06, 1F
文章代碼(AID): #1DVfiaWI (Statistics)
文章代碼(AID): #1DVfiaWI (Statistics)