Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • #16
    So far, the specific code has been running for more than 10 hours. It shouldn't have taken more than 7 hours max based on similar codes I ran with only small adjustments. So, maybe it's taking even longer than expected because I pressed a lot on the break/pause button. Is there anyway to stop a code which already runs without the break button? If I knew the code of Joseph before I started to run this code, I might have been able to stop it now.

    Comment


    • #17
      If it's possible to see the current progress of the current code, I'd also highly appreciate it.

      Comment


      • #18
        Have you been able to find answer to your question? I also experienced the never ending loop which cannot be terminated using Break.

        Comment


        • #19
          This is a one year old post. I think it's important to note that this is a self-inflicted wound. The break key does not work because Victoria used capture to ignore any errors that occurs in the loop. In Stata, pressing the break key generates an error (the error number is 1) which then stops execution. In other words, her code was written to explicitly ignore the break key. Here's a analogous example that preserves the break key functionality:

          Code:
          sysuse auto, clear
          expand 10
          gen alpha = . 
          forvalues j = 1/`=_N' { 
          
              capture {
                   ereturn clear 
                  regress  turn  mpg price rep78 if `j' != _n
                  replace alpha = _b[_cons] in `j' 
               }
               
               if _rc == 1 {
                   dis "Stopping now..."
                   // clean-up code...
                   exit 1
               }
           }
          Last edited by Robert Picard; 29 Sep 2015, 07:46.

          Comment


          • #20
            I see! So, if we use -capture- code. if we want to keep part of result, there is no way to stop loop until they finish, is there?

            Comment

            Working...
            X