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
Export Spearman output matrix to .pdfDear all, is it possible to export a Spearman Output (see picture) to pdf? I have tried the follow…
Creating a Panel Dataset with Dummies for StataHello, I have downloaded an excel raw data file that is in the form shown below. Is there a quick me…
Matching based on SIZE and Industry . dataex ID TIC SIZE PROT Industry_code LN_AUDFEE ----------------------- copy starting from the ne…
nested forloop with putexcel and use of alphabetHello, I'm trying to export a number of tables into excel. I'm trying to build a nested forloop in …
Repeating 1 annual data point 4 timesHi, how to I repeat 1 annual datapoint in order to give me 4 quarterly data points to match the rest…
Subscribe to:
Post Comments (Atom)
0 Response to Trying to label multiple variables using loop
Post a Comment