Hi,
I am new to Stata and I want to programmatically generate a list of variable names in a program which I want to hand over to another program as parameters. Unfortunately, if I hand the returned macro over as a string, Stata says " invalid name" and if I don't do that, then the list of variables is converted to values which is also unwanted.
Here is some example code:
gen a1=0
gen a2=1
program define test, rclass
local s "a1 a2"
return local mvl "`s'"
end
program define test2
syntax varlist(min=0 max=100)
di `0' `1'
end
test
test2 r(mvl)
test2 `r(mvl)'
test2 "`r(mvl)'"
Thanks a lot for your help!
Bob
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/