Previous PageNext Page

Rounding, reconsidered
But consider this code which does the rounding in two steps. The variables without the suffix are the metric conversions; the variables with the 2 suffix are the rounded values.

Proc Means data=HTWT;

Why aren't the means the same?
Variable N Mean Std Dev Minimum Maximum
-----------------------------------------------------------------------------
Weight 3 135.0000000 40.9267639 100.0000000 180.0000000
Height 3 64.6666667 4.7258156 61.0000000 70.0000000
KWeight 3 61.3636364 18.6030745 45.4545455 81.8181818
CHeight 3 164.2533333 12.0035717 154.9400000 177.8000000
KWeight2 3 61.3333333 18.8767935 45.0000000 82.0000000
CHeight2 3 164.2333333 12.0226176 154.9000000 177.8000000
KWeight3 3 60.6666667 18.4481255 45.0000000 81.0000000
CHeight3 3 163.6666667 11.9303534 154.0000000 177.0000000
-----------------------------------------------------------------------------
The raw weight mean = 15 2/3. Converting this to kilograms would be (15 2/3)/2.2 = 7.1212.
The mean of kweight is correct, 7.1212. The mean of kweight2 is 7.333.

The raw height mean = 15 2/3. Converting to centimeters is (15 2/3)·2.54 = 39.79333.
The mean of cheight is correct, 39.79333. The mean of cheight2 is 39.8.

Previous PageTable Of ContentsNext Page