Statalist


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

st: Rounding number


From   Maarten buis <maartenbuis@yahoo.co.uk>
To   stata list <statalist@hsphsun2.harvard.edu>
Subject   st: Rounding number
Date   Mon, 3 Mar 2008 13:36:36 +0000 (GMT)

--- "Ziad El-Khatib" wrote:
> tried to look for help round but did not understand it well.
> how to round variable (weight) to have it 0 decimal, e.g. 5 instead
> of 4.20?

It is conventional to round 4.20 down to 4 instead of up to 5, and this
is what -round- does. If you always want to round up you can use the 
-ceil- function, and if you always want to round down you can use the 
-floor- function:

. di round(4.20)
4

. di ceil(4.20)
5

. di floor(4.20)
4

Hope this helps,
Maarten


-----------------------------------------
Maarten L. Buis
Department of Social Research Methodology
Vrije Universiteit Amsterdam
Boelelaan 1081
1081 HV Amsterdam
The Netherlands

visiting address:
Buitenveldertselaan 3 (Metropolitan), room Z434

+31 20 5986715

http://home.fsw.vu.nl/m.buis/
-----------------------------------------


      __________________________________________________________
Sent from Yahoo! Mail.
A Smarter Inbox. http://uk.docs.yahoo.com/nowyoucan.html
*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index