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
Missing standard errors because of stratum with single sampling unit.How do I fix the problem of missing standard errors because of stratum with single sampling unit whe…
F-Test valuesHello, I'm performing some quite simple linear regression analyses (with the command reg followed by…
Forum like stataliest for new R usersHello stata community, I have been a long time stata user but need to get myself familiar with R fo…
Callaway and Sant'Anna Diff in DiffHello Stata community, I'm trying to replicated the recent development in DiD literature developed …
Multiple Regression with large numbers of variablesI'm attempting to perform multiple regression on large amounts of molecular data to model the associ…
Subscribe to:
Post Comments (Atom)
0 Response to Rounding, multiple decimals off and Locals
Post a Comment