Mr. Eggers,
I am not sure what operation you're trying to do, but you can try
something like this:
************************************************************************
foreach elem in a b c {
forvalues n=1/5 {
foreach var of varlist x1-x5 {
di " elem is `elem', n is `n', and var is `var' "
}
}
}
**************************************************************************
All this does is display some text based on the three loops that I have
defined. Variables x1-x5 need be defined for the innermost loop to work.
You can define them in the following way, which is also an example of a
simple loop:
forvalues i=1/5 {
gen x`i'=`i'
}
This will create x1-x5 where x1=1 for all observations, x2=2 and so on.
There is a great pdf by N. Cox about lists that I've found very helpful
in the past. It can be found at
http://www.cpc.unc.edu/services/computer/presentations/statatutorial/cox_article.pdf
I hope this helps.
DVM
_______________________________________________________________________________
Dimitriy V. Masterov
Work:
Center for Social Program Evaluation
1155 East 60th St. Room 038
Chicago, IL 60637
Work: (773)256-6005
Fax: (773)256-6313
*
* 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/