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   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   Re: st: problem with blabla if baz == float(#)
Date   Mon, 18 Nov 2002 14:33:28 -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?

Joseph Coveney suggested the use of a tolerance.
I'm sure he would agree readily that that's an
awkward solution. Mine perhaps will not
seem better.

But my reaction is: what's the real problem here?

If it's that you have a group you want to
treat the same in some way -- and what that
group has in common is that (say) -baz- has
the same value of some variable -- then
one good way to do it is to make sure
that you have a categorical variable
which can you deal with. For this I
recommend -egen, group()-. If Stata is
sometimes cryptic, elusive or puzzling
about what values exactly are (or are held as),
at least it will map the same values to the
same category.

Nick
n.j.cox@durham.ac.uk

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