Dear List,
I am trying to write a 'foreach x of varlist ...' loop in which I want
to use different data sets depending on which variable in varlist is
being processed. When run, the following program correctly outputs
"Line 1" but fails to load tempa.dta and I cannot figure out why. Any
tips will be most helpful. Thanks.
foreach x of varlist a b c {
if `x'==a {
use tempa, clear
}
if `x'!=a {
use tempb, clear
}
qui: do stuff
di "Line 1"
if `x'==a {
use tempa, clear
}
if `x'!=a {
use tempb, clear
}
qui: do stuff2
di "Line 2"
}
r.
Rajib Doogar,
Department of Accountancy,
The University of Illinois at Urbana-Champaign
1206 S. Sixth Street, Champaign, IL 61820
Ph: 217.244.8083, Fax: 217.244.0902
http://www.cba.uiuc.edu/doogar
*
* 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/