Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: code to round a continuous variable to the nearest 1/10th


From   Richard Goldstein <[email protected]>
To   [email protected]
Subject   Re: st: code to round a continuous variable to the nearest 1/10th
Date   Fri, 19 Aug 2005 11:33:08 -0400

use the round function (e.g., gen x2=round(x1,.1))

Note, however, that numbers such as .1 do not have an
exact binary representation and therefor you still might
not quite match the SAS results

Rich

Suzy wrote:
Dear Statalistmembers,

I am trying to replicate results from a SAS program and I need to know if there is a simple code to round to the nearest 10th for a continuous variable.

Thank you!
Suzy
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index