Statalist The Stata Listserver


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

Re: st: variables precision


From   sara borelli <[email protected]>
To   [email protected]
Subject   Re: st: variables precision
Date   Thu, 5 Apr 2007 23:57:00 +0200 (CEST)

thank you very much
sara
--- Maarten buis <[email protected]> ha scritto:

> >--- On Thu, 5 Apr 2007, sara borelli wrote:
> > If I write 'count if x<y' stata says that all
> > observations satisfy this inequality, when in fact
> > the values 'look' the same. I think this has to do
> > with the fact that x is stored as double, while y
> > is stored as float. Is there any way I can say
> stata
> > to read the values as they "appear"
> 
> yet another solution that does exactly what Sara
> asked is to use the
> -round- function. The variable as they "appear"
> (presumably after
> -list-) are rounded, so why not round yourself when
> evaluating the
> inequality.
> 
> *------------ begin example ------------
> sysuse auto, clear
> gen price2 = price - 0.001
> format price2 %8.0gc
> list price price2 in 1/10
> count if price2 == price
> count if round(price) == round(price2)
> *----------- end example -------------
> (For more on how to use examples I sent to the
> Statalist, see:
> http://home.fsw.vu.nl/m.buis/stata/exampleFAQ.html )
> 
> 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/
> -----------------------------------------
> 
> 
> 		
>
___________________________________________________________
> 
> The all-new Yahoo! Mail goes wherever you go - free
> your email address from your Internet provider.
> 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/
> 



	

	
		
___________________________________ 
L'email della prossima generazione? Puoi averla con la nuova Yahoo! Mail: 
http://it.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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index