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: using foreach to add value labels
From
Jacob McDermott <[email protected]>
To
[email protected]
Subject
st: using foreach to add value labels
Date
Thu, 25 Jul 2013 10:47:22 -0500
Hello statalist,
I am trying to add value labels to multiple variables at the same time,
but am having no success.
The following does not work but hopefully illustrates what I want to do:
foreach var of list I872 I873 I874 I875 I835 I842 I837 I844 I911 I912 {
lab val K`var' `var'
lab val L`var' `var'
}
So, I want:
lab val KI872 I872
lab val LI872 I872
lab val KI873 I873
lab val LI873 I873
...
lab val KI912 I912
lab val LI912 I912
I could certainly just write this all out, but I imagine there is a
faster / more compact way to code this.
Thanks for the help,
Jacob
*
* 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/