A secondary issue here is that you may well
get bitten if you rely on a computer using
finite precision binary to do what you
think it should in adding 0.01.
This is a hoary perennial, documented at [U] 13.10
Precision and problems therein in the
Stata 9 documentation and in the corresponding
section in earlier editions of the manual.
The crunch here is that 0.01 looks innocuous but has
no _exact_ binary equivalent. The same goes for
most multiples of 0.01.
A tertiary issue is that there is no gain and
some efficiency loss here in using variables to
hold constants.
P.S. spelling is Stata.
Nick
[email protected]
William P. Kittredge, Ph.D.
> I'm just getting started with STATA and am trying to
> get the IF command to select using multiple
> catagories.
>
> The 'do' file below is supposed to keep cases in which
> one (or more) of the eligibility conditions applies:
>
> poverty rate (pov_rate) >= national average plus 1
> point (nat_avg)
> OR
> unemployment rate (ue_rate) >= national average
> (ue_rate)
>
> OR
>
> 1 year change in unemployment rate (ue_chg) as long as
> the resulting unemployment rate is > the national
> average.
>
> When I run this against known datasets, it fails to
> drop the appropriate observations.
>
> Am I overlooking something obvious?
>
> Here's the code:
>
> use "C:\Documents and Settings\wkittredge\My
> Documents\SACI STATA\book4.dta", clear
> gen nat_pov = .106
> gen nat_ue = .052
> gen pov_rate = ncollpov/ncolpovu
> gen ue_rate = bls_unempl_rate_04
> gen ue_chg = bls_unempl_rate_04 - bls_unempl_rate_03
> order pov_rate ue_rate ue_chg nat_pov nat_ue cdbgname
> rgn state
> keep if pov_rate >=(nat_pov+.01)|ue_rate>=
> (nat_ue+.01)|ue_chg>=.4 & ue_rate>nat_ue
> list pov_rate ue_rate ue_chg cdbgname state, clean
>
*
* 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/