Bookmark and Share

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: RE: Read variable labels


From   "Liao, Junlin" <[email protected]>
To   "[email protected]" <[email protected]>
Subject   st: RE: RE: Read variable labels
Date   Mon, 21 Feb 2011 20:35:30 +0000

Nick,

This is very helpful. Thanks very much.

Junlin

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Nick Cox
Sent: Monday, February 21, 2011 1:54 PM
To: '[email protected]'
Subject: st: RE: Read variable labels

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/


________________________________
Notice: This UI Health Care e-mail (including attachments) is covered by the Electronic Communications Privacy Act, 18 U.S.C. 2510-2521, is confidential and may be legally privileged.  If you are not the intended recipient, you are hereby notified that any retention, dissemination, distribution, or copying of this communication is strictly prohibited.  Please reply to the sender that you have received the message in error, then delete it.  Thank you.
________________________________

*
*   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index