Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Masoumeh Sanagou
    started a topic rounding methods

    rounding methods


    Dear Statalist,


    I have 3 variables

    b1 b2 b3

    gen b=b1+b2+b3
    then I rounded the numbers:
    gen c1=round(b1)
    gen c2=round(b2)
    gen c3=round(b3)
    and then
    gen c=c1+c2+c3
    however, b and c are not equal.

    My question:

    Is there any rounding methods to make b equal to c?


    Code:
    b1                     b2                b3
    32.64           .6044444      .7555556
    14.28261     .3260869      .3913044
    21.72766     .4893617      .7829787





  • William Lisowski
    replied
    Following up on Clyde's response, suppose your three variables are each 1/3. If you were doing the rounding by hand, not using Stata, each variable would round to 0, so the sum of the rounded variables would be 0. But the sum of the unrounded variables would be 1, and that is what that sum would round to.

    Again, the problem with what you seek is not a Stata problem.

    Leave a comment:


  • Clyde Schechter
    replied
    You are asking for the mathematically impossible.

    Leave a comment:

Working...
X