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
Kaplan Meier, Multi-survival analysis on one graphHello, I am able to graph my trade spell duration survival over a 30year period using the Code: st…
Which method does xtlogit/clogit use to estimate a fixed effects model (i.e. mean difference/first difference/LSDV)?In Asymmetric Fixed-effects Models for Panel Data (available here open access: https://journals.sage…
Exporting frequency table using esttabHi, I am trying to export the frequency table using esttab command. My observations are in the decim…
Encountering error r(198) while running a loop in stataHI, I am encountering error while running a loop in stata. The following is my code HTML Code: fo…
Verification of logic behind IV approachI hope this is not too elementary a post for this forum. However, since I am not sure, I thought I w…
Subscribe to:
Post Comments (Atom)
0 Response to Trying to label multiple variables using loop
Post a Comment