Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: RE: Importing variable (not value) labels


From   Austin Nichols <[email protected]>
To   [email protected]
Subject   Re: st: RE: Importing variable (not value) labels
Date   Wed, 6 Jan 2010 14:11:17 -0500

Or,
you can -merge- and loop over labels, like so:

clear
input str20 name str20 lab
"make"     "New Make and Model"
"price"    "New Price"
"mpg"      "New Mileage"
"rep78"    "New Repair Record"
"headroom" "New Headroom"
"trunk"    "New Trunk space"
end
save varlabs

sysuse auto
merge using varlabs
count if !mi(name)
forv i=1/`r(N)' {
 la var `=name[`i']' "`=lab[`i']'"
 }
drop _merge name lab

erase varlabs.dta


On Wed, Jan 6, 2010 at 1:05 PM, Nick Cox <[email protected]> wrote:
> Yes, if you do it interactively, e.g. within the Data Editor, in which
> case -lab var- is still implicit. But I don't think that's what you're
> seeking, as that would be more work, not less.
>
> Otherwise no. But you should be able to make it easier by a global edit
> of a text file containing the information in a decent text editor to
> produce a .do file.
>
> Nick
> [email protected]
>
> Dorothy Bridges
>
> I need to label dozens of variables.  Is there a way to do this
> without using the "lab var" command for each one?  I have the variable
> names and labels in an excel (or .dta) file.

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index