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]

Re: st: using foreach to add value labels


From   Jacob McDermott <jpmcd87@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: using foreach to add value labels
Date   Thu, 25 Jul 2013 10:59:42 -0500

Thank you!  I assumed it was something wrong with the K`var', L`var' part.
I used newlist, and the loop ran.

On 7/25/2013 10:54 AM, Scott Merryman wrote:
The -foreach- statement should be -foreach var of varlist ... - not
-...of list ...-

Scott


On Thu, Jul 25, 2013 at 10:47 AM, Jacob McDermott <jpmcd87@gmail.com> wrote:
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'
}

*
*   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