charleszhong28 发表于 2009-11-29 06:57
俺是初学者, 请教下面的三段DATA步,为什么YY,YY1和YY2的值不一样?
data tem;
input xx 6.1;
input yy 6.1;
cards;
2.12E4
7200000
;
run;
data tem1;
input xx1 6.1 yy1 6.1;
cards;
2.12E4 7200000
;
run;
data tem2;
input xx2 6.1 yy2 :6.1;
cards;
2.12E4 7200000
;
run;
执行后TEM中YY的值为72000,TEM1的YY1为7200 ,TEM2中的YY2为72000 ??
多谢了!
In your case YY2 should be 720000 instead of 72000. The correct one is 7200000.
It can be very tricky when one reads raw data with informats in the input statement.
It implies some assumptions by informats besides informat instructions
1) variable type
2) variable length if char vars
3) position or point
4) the colon (:) modiflier will provide additional instructions
Look SAS online help or documentation.
HTH
Is it a homework assignment?