Statalist


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

st: re: WHILE command


From   Kit Baum <baum@bc.edu>
To   statalist@hsphsun2.harvard.edu
Subject   st: re: WHILE command
Date   Mon, 17 Mar 2008 15:26:46 -0400

Nick W said

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?

As Nick C has pointed out, nothing stops you from using a forvalues loop over a large number of values and testing within the loop to determine whether some condition is now satisfied (e.g., if the norm of the gradient is now less than epsilon), and using

continue, break

to terminate the loop at that point.


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


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