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

st: multiple IF commands

From   "William P. Kittredge" <[email protected]>
To   [email protected]
Subject   st: multiple IF commands
Date   Wed, 6 Jul 2005 07:38:46 -0700 (PDT)


I'm just getting started with STATA and am trying to
get the IF command to select using multiple

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) 
unemployment rate (ue_rate) >= national average


1 year change in unemployment rate (ue_chg) as long as
the resulting unemployment rate is > the national

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


Bill Kittredge

William P. Kittredge, Ph.D.
Research Director
Center for the Study of Capital Markets and Democracy
voice: 571-344-5034
email: [email protected]
"if to do were as easy as to know what were good to do,
chapels had been churches and poor men's cottages princes' palaces"
*   For searches and help try:

© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index