I have been trying to get the round function to feed some locals that I use to create graphs labels, however, rounding has proven particularly challenging, as this actual example illustrates
. qui centile variable if year==2007, c(10 25 40 50 60 75 90)
. local pop=r(N)
. count if variable==0 & year==2007
2,657
. local zeros=r(N)
. local ptile = 100*round(`zeros'/`pop',0.0001)
. di "zero ptile=`ptile'"
zero ptile=84.54000000000001
. local ptile = round(100*`zeros'/`pop',0.0001)
. di "zero ptile=`ptile'"
zero ptile=84.54000000000001
As you see, this is not nice rounding. When I try to use this function to label my graphs and other things I don''t know how to overcome this problem. Can anyone tell me how??
Probably this has been solved before, but I have not being able to find how to solve this matter so I woudl appreciate if I am pointed the right forum too.
0 Response to Rounding, multiple decimals off and Locals
Post a Comment