Use the round() function:
. gen roundx = round(x, .1)
Thomas J. Steichen
[email protected]
----------------------------------------------------------------------------
Facts do not cease to exist because they are ignored. - Aldous Huxley
----------------------------------------------------------------------------
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]] On Behalf Of Suzy
> Sent: Friday, August 19, 2005 11:29 AM
> To: [email protected]
> Subject: st: code to round a continuous variable to the nearest 1/10th
>
>
> 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/
>
-----------------------------------------
CONFIDENTIALITY NOTE: This e-mail message, including any attachment(s),
contains information that may be confidential, protected by the attorney-
client or other legal privileges, and/or proprietary non-public
information. If you are not an intended recipient of this message or an
authorized assistant to an intended recipient, please notify the sender by
replying to this message and then delete it from your system. Use,
dissemination, distribution, or reproduction of this message and/or any of
its attachments (if any) by unintended recipients is not authorized and may
be unlawful.
*
* 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/