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.
Related Posts with Rounding, multiple decimals off and Locals
reghdfeHello, I have Stata 15.1 installed and today reghdfe stopped working and gives me the following erro…
Inlist Expression too longHi guys, I am a Stata beginner and have a problem in generating a dummy called aggregate. I tried i…
date differences using max values where ID values are duplicateHere is the master data I have. Code: * Example generated by -dataex-. To install: ssc install dat…
Is it necessary to use the unit root test before estimation?hi I have micro panel data t = 7 years N=35 i'll use GMM Is it necessary to use the unit root test b…
Blank estimation values with non linear least squaresDear experts, For my master thesis I'm trying to replicate the results of Boswijk, Hommes and Manza…
Subscribe to:
Post Comments (Atom)
0 Response to Rounding, multiple decimals off and Locals
Post a Comment