Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: advance a -foreach- loop?


From   "junk@spandrel.net" <junk@spandrel.net>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   Re: st: advance a -foreach- loop?
Date   Fri, 16 May 2008 07:36:36 -0700

Austin Nichols wrote:
>
> The reason for moving the groups of variables into a separate macro
> and dealing with the groups in a separate loop is: suppose for any
> given variable v, you can identify a group of 6 related variables m_v
> (including v itself) and process all 6 inside the loop.  When you
> reach the next variable in group m_v, you will repeat this process,
> making the whole thing take 6 times as long as it should.  OTOH, the
> construction of a long local macro containing groups should take a
> negligible amount of time, and then the groups can be looped over one
> by one.
>
>

This is the root of my question - I want to advance the -foreach- loop
past the 6 variables. I tried -drop-ing the 6 but then the -foreach-
loop chokes.

I'm not concerned about the processing time; I want to group those 6
into a single table that is output into a report, and if I can't skip
them, I end up printing the same table 6 times.

I think the best solution may be the one suggested by Joseph Coveney,
to use a -while- loop, which lets me advance over the 6 with -gettoken-.

cheers,
Jeph

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

_____________________________________________________________________
Mensaje analizado y protegido por Telefonica Empresas
*
*   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/

Privileged, confidential or patient identifiable information may be contained in this message. This information is meant only for the use of the intended recipients. If you are not the intended recipient, or if the message has been addressed to you in error, do not read, disclose, reproduce, distribute, disseminate or otherwise use this transmission. Instead, please notify the sender by reply e-mail, and then destroy all copies of the message and any attachments.

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