Hi all,
I am trying to label multiple variables at once using loop.
For instance, variables q2_4_1_1,...,q2_4_1_6 should all be labelled as "Cows"
On the other hand, variables q2_4_2_1,...,q2_4_2_6 should all be labelled as "Chicken"
I have tried the following:
[CODE][local x=1/6
local y=1/3
local localvarlabels "Cows" "Chicken" "Goats" "Others"
foreach v of varlist q2_4_`x"_`y" q2_4_`x"_99 {
label var `v' "`localvarlabels`"
}
/CODE]
Can someone please tell me what am I doing wrong here?
Thanks in advance.
Related Posts with Trying to label multiple variables using loop
Using stcrreg with the mi commandHi All, After not having much of an issue with my MI (multipley imputed) data and the stccreg comma…
add legend to one of the graphs in -graph combine-Dear all statalisters, I now face a problem in dealing with drawing a combined graph with adding a l…
compare substrings in same var - same same, but differentHi. I have a problem with a huge list of >19,000 towns. There are > 1,200 towns with duplicat…
Making new variable from first letter of string variableHi Statalist, Thanks for being a great forum which already has helped a lot! I'm new here, quite f…
Bayesian approach: what to do when it differs from the frequentist approach?Dear Forum Members, I'm somewhat puzzled by the results given from 2 down-to-earth models, one usin…
Subscribe to:
Post Comments (Atom)
0 Response to Trying to label multiple variables using loop
Post a Comment