Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: foreach syntax


From   Kit Baum <[email protected]>
To   [email protected]
Subject   st: foreach syntax
Date   Wed, 21 Feb 2007 08:40:58 -0500

The following works in Stata9:
local x =3D"lr1-ul6"
foreach i of local x{
su `i'
}

but
local x =3D"lr1-ul6"
foreach i of local x{
ttest `i',by(gender)
}

with error r(103) too many variables specified.
Could somebody please tell me what I am doing wrong.


I can't believe that either example could be considered correct syntax. What does your local statement mean? I don't know how to interpret =3D"lr1-ul6".


Kit Baum, Boston College Economics
http://ideas.repec.org/e/pba1.html
An Introduction to Modern Econometrics Using Stata:
http://www.stata-press.com/books/imeus.html


*
* 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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index