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: Creating local from levelsof exceeding 255 characters


From   Nick Cox <[email protected]>
To   [email protected]
Subject   Re: st: Creating local from levelsof exceeding 255 characters
Date   Fri, 14 Jan 2011 13:53:37 +0000

You should show your code to get better comments on what you are doing
wrong: it is likely to be your error and not that of -foreach-. But a
standard idiom is something like

levelsof id, local(ID)
foreach id of local ID {
       <code referrring to `id'>
}

See for example

FAQ     . . . . . . . . . . Making foreach go through all values of a variable
        . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  N. J. Cox
        8/05    Is there a way to tell Stata to try all values of a
                particular variable in a foreach statement without
                specifying them?
                http://www.stata.com/support/faqs/data/foreach.html

Nick

On Fri, Jan 14, 2011 at 11:09 AM, Palan, Stefan
([email protected]) <[email protected]> wrote:
> Hi Maarten and Nick,
>
> Thanks for your answers!
>
> At least now I know that I created the macro correctly. However, the truncation problem seems to occur when I use it in a foreach statement. What I would like to do is loop over all values in my macro, but it stops after 255 characters. Unfortunately, Maarten's hint regarding the help file didn't get me very far. Sorry if I missed it, but can you help me with how I would loop over all the values in my correctly defined macro?
>

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