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: adding the variable name to the label text


From   "Sarah Edgington" <[email protected]>
To   <[email protected]>
Subject   st: RE: adding the variable name to the label text
Date   Tue, 21 Jan 2014 13:49:34 -0800

Kevin,
It's not clear from what you posted what you've tried to do to change the
labels.
Adding the following line at the end of your loop should accomplish what you
need:
label var `x' "`x' `u'"

-Sarah

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Snapp, Kevin
Michael
Sent: Tuesday, January 21, 2014 1:27 PM
To: [email protected]
Subject: st: adding the variable name to the label text

I have a large PSID file I am working on.  As many of you will know the
variable names aren't the most informative.  I would like to add the current
variable names (like ER360001) to the front of the variable label string.
After that is done I will go through and manually rename the variables that
I want one by one.  If have been able to use the following  to display what
I want in the new label's, but I can't seem to change the labels.

. foreach x of varlist _all{
  2. local u : variable label `x'
  3. display  "`x'"  " " "`u'"
  4. }

Any input is appreciated.

Kevin Snapp


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

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


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index