Statalist The Stata Listserver

[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: rounding in STATA

From   "Siyam, Amani" <[email protected]>
To   <[email protected]>
Subject   st: rounding in STATA
Date   Thu, 13 Apr 2006 15:04:57 +0200

Dear Stata-listers

I have a minor issue with the way STATA is rounding, for example a
variable to one decimal place.

I used the command

gen x=round(y, 0.1)

Comparing the two variables, I noticed the that when:

   x=			  y=

 8.750		 8.7
 5.752		 5.8
23.256		23.3

Is there a way I can modify the function to round "x"=8.750 to be 8.8

Or should I put together my own code to get the rounding I want.

Many thanks in advance...


*   For searches and help try:

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