Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Limit of numlist


From   Alan Neustadtl <alan.neustadtl@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Limit of numlist
Date   Thu, 6 Oct 2005 10:46:26 -0400

Yes...thank you...that seems like a better way to adress this issue.

Thank you,
Alan

On 10/6/05, Nick Winter <nw53@cornell.edu> wrote:
> This doesn't speak to the numlist limit question, but your code could
> simply use -forvalues- rather than -foreach ... numlist-.
>
> There is no reason to have Stata create and store the numlist, rather
> than simply iterate through the values from 1 to N.
>
> Your code could be:
>
> forvalues i = 1/`l' {
>          ...
> }
>
> Or even better,
>
> forvalues i = 1/`=_N' {
>          ...
> }
>
> That is, you can skip the -count- and just have Stata evaluate the
> macro expression `=_N'.
>
> --Nick WInter
>

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index