作者paselalps (what matters)
站内Statistics
标题Re: [问题] SAS从EXCEL读入之资料有"."如何处理?
时间Tue Mar 15 06:48:02 2011
※ 引述《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
1F:推 cbm:谢谢你的分享^^ 03/15 23:06