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

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


From   "Guillaume Frechette" <[email protected]>
To   [email protected]
Subject   st: problem with blabla if baz == float(#)
Date   Sun, 17 Nov 2002 21:18:23 +0000

Dear Statalisters: I apologize as this is a version of a rather common problem and thus it might already have been dealt with on the list. Everyone knows that

. tab test3 if test3 == 1/3
no observations

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

. gen foo = 1/3

. tab foo

foo | Freq. Percent Cum.
------------+-----------------------------------
.3333333 | 850 100.00 100.00
------------+-----------------------------------
Total | 850 100.00

. tab foo if foo == 1/3
no observations

is not a problem with Stata but as to do with binary storage and the solution is

. tab foo if foo == float(1/3)

foo | Freq. Percent Cum.
------------+-----------------------------------
.3333333 | 850 100.00 100.00
------------+-----------------------------------
Total | 850 100.00

My problem is a version of this, but 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?

Thanks in advance,

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