Hi Statalists,

I am trying to create a list from variables, that I can loop through. But the script I wrote only actions the first variable in the list.

Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input str2 id
"a"
"b"
"c"
"d"
"e"
"f"
"g"
"h"
"i"
"j"
"k"
end

local idlist = id

foreach i in `idlist' {
    display "`i'"
}
How do I make the loop go over all variables in list?

Thanks so much!