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: loop
From
Jorge Eduardo Pérez Pérez <[email protected]>
To
"[email protected]" <[email protected]>
Subject
Re: st: loop
Date
Tue, 15 Nov 2011 12:33:28 -0500
You can use -capture- and -continue-, see the help for those
commands. For example, in the following code, the second set of
initial values causes non-convergence, so Stata produces an error
message and goes on with the next iteration.
sysuse auto, clear
* Define three sets of initial values
local i1="0 0"
local i2="-2000 -2000"
local i3="10 10"
* Loop over initial values
foreach x in i1 i2 i3 {
cap nois logit foreign mpg, from(``x'', copy) iter(100) nolog
if _rc continue
}
_______________________
Jorge Eduardo Pérez Pérez
On Tue, Nov 15, 2011 at 12:05 PM, Carlos Aller <[email protected]> wrote:
> Dear statalisters
>
> I've designed a loop so in each iteration I assign different initial
> values to my estimator. The problem is when the estimation do not
> achieve convergence and the program stops. The "no stop" command permits
> to continue with the program but skips the loop and what I wanna get is
> to continue the loop with the next iteration. Do you know how to do it?
>
> Thanks in advanced,
> Carlos.
> *
> * For searches and help try:
> * http://www.stata.com/help.cgi?search
> * http://www.stata.com/support/statalist/faq
> * http://www.ats.ucla.edu/stat/stata/
>
>
>
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/