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:
Can someone please tell me what am I doing wrong here?
Thanks in advance.
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`" }
Thanks in advance.
Comment