Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: problem with blabla if baz == float(#)


From   "Guillaume Frechette" <[email protected]>
To   [email protected]
Subject   Re: st: problem with blabla if baz == float(#)
Date   Mon, 18 Nov 2002 16:31:24 +0000

Guillaume Frechette

> My problem ... the use of float doesn't seem to be the
> solution. Here's an example

> . gen foo = 1/3

> . gen bar = 1/3

> . gen baz = 1-foo-bar

> . tab baz

>         baz |      Freq.     Percent        Cum.
> ------------+-----------------------------------
>    .3333333 |        850      100.00      100.00
> ------------+-----------------------------------
>      Total |        850      100.00

> . tab baz if baz == float(1/3)
> no observations

> Can someone tell me how to get Stata to know to recognize baz as
equal to
> 1/3?
Nick proposed one solution, here's another one which I just found:

. tab baz if baz==1-float(1/3)-float(1/3)

baz | Freq. Percent Cum.
------------+-----------------------------------
.3333333 | 1257 100.00 100.00
------------+-----------------------------------
Total | 1257 100.00

g

_________________________________________________________________
MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*. http://join.msn.com/?page=features/virus

*
* 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