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: Capture break in mata


From   Phil Schumm <pschumm@uchicago.edu>
To   George Vega Yon <g.vegayon@gmail.com>
Subject   Re: st: Capture break in mata
Date   Tue, 1 Oct 2013 16:49:27 -0500

On Oct 1, 2013, at 4:28 PM, George Vega Yon <g.vegayon@gmail.com> wrote:
> Phill, thanks for the correction. I'm not sure why but my text editor erased the "++" symbols both from the -while- and the -for- (that's why you can see two blank spaces right after -i- and -j-) Still, I don't get what I want.


I'm fairly certain that the code I gave will do what you want.  Looking back at your original code, and plugging in the missing incrementers, I believe the problem is simply that the loop executes to completion so quickly that your break is not hitting inside the loop.  Try bumping up the max iterations of the -while- loop to 1e5 or the limit of the inner loop to 1e5, and you should get the behavior you're expecting.


-- Phil


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index