Hi all, I have the total number of pupils in the year 1992 and I need to calculate the number of pupils in each course in 1992. see below code . The problem is the numbers I obtained have decimals points, when I round them they don't always add up to the total. Does anyone know how to fix this issue so when I sum the number of pupils in each course it would add up to 1145. data have;
input id :$4. pupils1990 fraction total1992;
datalines;
100 50 0.04784689 1145
101 5 0.004784689 1145
102 131 0.125358852 1145
104 21 0.020095694 1145
105 15 0.014354067 1145
106 3 0.002870813 1145
107 12 0.011483254 1145
108 5 0.004784689 1145
109 17 0.016267943 1145
110 29 0.027751196 1145
112 152 0.145454545 1145
113 23 0.022009569 1145
114 37 0.035406699 1145
115 40 0.038277512 1145
116 65 0.062200957 1145
117 52 0.049760766 1145
118 44 0.042105263 1145
119 7 0.006698565 1145
120 9 0.00861244 1145
121 4 0.003827751 1145
122 7 0.006698565 1145
123 8 0.007655502 1145
124 27 0.025837321 1145
125 234 0.223923445 1145
126 16 0.015311005 1145
127 16 0.015311005 1145
128 16 0.015311005 1145
;
data want;
set have;
pupils1992 = round(fraction*total1992);
run;
proc print data=want;
run; Any help would be greatly appreciated. Thank you.
... View more