Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
st: RE: Read variable labels
From
Nick Cox <[email protected]>
To
"'[email protected]'" <[email protected]>
Subject
st: RE: Read variable labels
Date
Mon, 21 Feb 2011 19:53:42 +0000
In addition, it may be worth knowing about -label language-.
Also, if the long labels were ever thought good, you might want them again in the future, so various ways of backing up might be considered.
Nick
[email protected]
Nick Cox
Suppose you want to replace "University" by "U" in a bunch of variable labels.
foreach v of var * {
local label : var label `v'
local label : subinstr local label "University" "U", all
label var `v' `"`label'"'
}
The key stuff here is documented at help -extended_fcn-. As Maarten was remarking only the other day, it's sometimes easier to remember to go to the help for -macro- and then jump.
-varm- is good for doing this for a few labels.
Liao, Junlin
Does anyone know how to read out variable labels? For example, I have a group of variables with long labels. I want to programmatically shorten the labels by replacing keywords. How do I get the variable labels in functions?
*
* 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/