I have the following little loop that works. Before creating the macro var "curvar" (which works in the next expression to add a label to a variable), I was trying to add the -word("`symbol'", `j')- to the label command [label var word("`symbol'", `j') "`I'"] and getting all kinds of syntax errors.
Is it possible in Stata to evaluate such expressions as the word() function within the code without having to create the macro var? In some coding languages there are functions such as eval(), etc. that can evaluate the expression within the code. I was wondering if such a thing exists in Stata.
*put labels on vars
local j=0
foreach i in "`lblnam'" {
local ++j
local curvar=word("`symbol'",`j')
label var `curvar' "`i'"
}
Is it possible in Stata to evaluate such expressions as the word() function within the code without having to create the macro var? In some coding languages there are functions such as eval(), etc. that can evaluate the expression within the code. I was wondering if such a thing exists in Stata.
*put labels on vars
local j=0
foreach i in "`lblnam'" {
local ++j
local curvar=word("`symbol'",`j')
label var `curvar' "`i'"
}
Comment