Dimitriy V. Masterov included this code
fragment in his answer to a graphical question,
which I have commented on separately. (I've
edited out details irrelevant to the point I'm
going to make.)
local list score*
unab list: `list'
local graph ""
foreach var of varlist `list' {
local graph "`graph' (line `var' year, sort) "
}
In essence this could be telescoped once
unab list: score*
local graph ""
foreach var of varlist `list' {
local graph "`graph' (line `var' year, sort) "
}
and indeed twice
local graph ""
foreach var of varlist score* {
local graph "`graph' (line `var' year, sort) "
}
The -foreach- loop can work directly on a wildcarded
list.
Nick
[email protected]
*
* 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/