Radu Ban
> I have the variable labels for my dataset as two variables. i.e:
>
> var_name var_label
> var1 label1
> var2 label2
> ..... .......
> varn labeln
>
> var1 through varn all exist as variables in my dataset. is
> there a speedy
> way to assign labels, taking advantage of these two variables?
>
Essentially the same question was asked by
Hans Baumgartner on Tuesday.
forval i = 1 / <nvars> {
local name = var_name[`i']
local label = var_label[`i']
label var `name' `"`label'"'
}
where for <nvars> you should plug
in the number of variables.
Alternatively,
local i = 1
foreach v of var * {
local label = var_label[`i']
label var `v' `"`label'"'
local i = `i' + 1
}
Nick
[email protected]
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/