Statalist The Stata Listserver


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

Re: st: suppress error messages


From   Friedrich Huebler <huebler@rocketmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: suppress error messages
Date   Tue, 8 May 2007 08:48:17 -0700 (PDT)

Lukas,

See -help capture-. You can also add an -if- statement at the
beginning of the loop that checks if the current model can be
estimated.

forvalues i = 1(1)5000 {

  * Move to next regression if condition is true
  if [condition, e.g. sample size too small] {
    continue
  }

  [other commands]

}

Friedrich

--- Lukas Mohler <Lukas.Mohler@unibas.ch> wrote:
> Dear Statalisters,
> 
> I'm running several thousand regressions within a forvalues loop.
> It goes like
> this:
> 
> forvalues 1(1)5000{
> 
> ivreg2 ..... if selection==x_1, gmm robust
> 
> x_1=x_1+1
> 
> estout .....
> 
> }
> 
> For some values of selection I do not have enough observations to
> estimate the
> model. Also, other problems could arise with the data.
> 
> This is why I'd like to suppress all possible error messages and
> continue to loop through my regressions.
> 
> Thanks!
> 
> ---
> Lukas Mohler
> Abteilung Aussenwirtschaft und Europäische Integration
> Wirtschaftswissenschaftliches Zentrum
> Universität Basel
> Petersgraben 51
> 4003 Basel
> Switzerland
> +41 61 267 07 70
> ---







 
____________________________________________________________________________________
8:00? 8:25? 8:40? Find a flick in no time 
with the Yahoo! Search movie showtime shortcut.
http://tools.search.yahoo.com/shortcuts/#news
*
*   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