Statalist


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

Re: st: Re: WHILE command


From   Nick Winter <[email protected]>
To   [email protected]
Subject   Re: st: Re: WHILE command
Date   Mon, 17 Mar 2008 09:24:49 -0400

How does one do this in cases where one cannot calculate, in advance, the number of repetitions needed, or the list of items to be acted upon?

--Nick Winter

Kit Baum wrote:

Don't bother with the while command. Use forvalues or foreach for your loops and life will be much simpler.

Kit Baum, Boston College Economics and DIW Berlin
http://ideas.repec.org/e/pba1.html
An Introduction to Modern Econometrics Using Stata:
http://www.stata-press.com/books/imeus.html


On Mar 17, 2008, at 02:33 , statalist-digest wrote:


I have a few questions about the WHILE command,
1. When does it evaluate the WHILE condition? If it becomes false does
it immediately exit the WHILE loop?
2. Can both sides of the WHILE condition be local variables that may
be updated in the WHILE statement ?  WHILE 'i' < 'j' {  ..... local i
= 'i' + 'j' .... local j = 'j' + 1.....  }
*
*   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/
--
--------------------------------------------------------------
Nicholas Winter                                 434.924.6994 t
Assistant Professor                             434.924.3359 f
Department of Politics                  [email protected] e
University of Virginia          faculty.virginia.edu/nwinter w
PO Box 400787, 100 Cabell Hall
Charlottesville, VA 22904

*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index