Statalist The Stata Listserver


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

st: Re: Round


From   "Michael Blasnik" <michael.blasnik@verizon.net>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: Re: Round
Date   Tue, 31 Jan 2006 13:32:04 -0500

If you want to round to 4 digits, -help round()- will show you:
replace varY=round(varY,.0001)

if you only want to round numbers just below 1 to 1, then

replace varY=1 if varY>.9999 & varY<=1

Michael Blasnik

----- Original Message ----- federica dm" <dmfederica@yahoo.it> wrote
Subject: st: Round

Dear Statalistmembers,

I would like to know how to round the last number for
a continuous variable, such as income, to unity.
I&#8217;ll try to be more explicit whit an example;
supposing that the variable is like that:

N. Obs.    varY
1     0.003
2     0.045
3     0.050
.
.
2348   .9999986
2349   .9999986
2350   .9999986

 and I would like to round only the last 3 numbers to
1, what should I do?

Thank you!
Federica
*
*   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–2021 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index