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:21:51 +0000
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.
Nick
[email protected]
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/