Skip to content
This repository has been archived by the owner on Feb 20, 2022. It is now read-only.

Update rounding_4sigdig.do #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jrothbaumcensus
Copy link
Contributor

Log of existing code and fix

Log of code as before and with fix:

. gen test = -123456

. replace test = round(test,10^(floor(log10(test))-3))
(10 real changes made, 10 to missing)

. sum test

Variable |        Obs        Mean    Std. Dev.       Min        Max

-------------+---------------------------------------------------------
test | 0

.
. replace test = -123456
(10 real changes made)

. replace test = round(test,10^(floor(log10(abs(test)))-3))
(10 real changes made)

. sum test

Variable |        Obs        Mean    Std. Dev.       Min        Max

-------------+---------------------------------------------------------
test | 10 -123500 0 -123500 -123500

Log of existing code and fix

Log of code as before and with fix:

. gen test = -123456

. replace test = round(test,10^(floor(log10(test))-3))
(10 real changes made, 10 to missing)

. sum test

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
        test |          0

. 
. replace test = -123456
(10 real changes made)

. replace test = round(test,10^(floor(log10(abs(test)))-3))
(10 real changes made)

. sum test

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
        test |  10     -123500           0    -123500    -123500
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant