|
楼主

楼主 |
发表于 2005-11-10 00:18:26
|
只看该作者
请教,PROC REPORT的COMPUTE语句
程序如下:
data houses;
input style $ sqfeet bedrooms price dollar9. baths;
datalines;
RANCH 1250 2 $64,000 2
SPLIT 1190 1 $65,850 2
CONDO 1400 2 $80,050 1
TWOSTORY 1810 4 $107,250 3
RANCH 1500 3 $86,650 2
SPLIT 1615 4 $94,450 3
SPLIT 1305 3 $73,650 2
CONDO 1390 3 $79,350 2
;
proc report data="houses" nowd;
column style bedrooms baths BedBathRatio;
define style / order;
define bedbathratio / computed format=4.2;
compute bedbathratio;
bedbathratio=baths.sum/bedrooms.sum;
endcomp;
run;
proc report data="houses" nowd;
column style bedrooms baths BedBathRatio;
define style / order;
define bedbathratio / computed format=4.2;
compute bedbathratio;
bedbathratio=baths/bedrooms;
endcomp;
run;
为什么第一个REPORT可以正常运行,第二个的LOG里有
NOTE: NOTE: Division by zero detected at line 1 column 20.
BEDROOMS的值都不为0. BEDBATHRIATO的值都是MISSING
BEDBATHRATIO = BATHS.SUM/BEDROOMS.SUM和BEDBATHRATIO = BATHS/BEDROOMS的区别是什么,这里为什么要用.SUM?
请高手指点.谢谢 |
|