Announcement

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

  • break key/button not working

    using jul3 update to StataSE on windows x64:
    neither the break key nor the red break button works to interrupt the following do file:

    forvalues i = 1/315 {
    cap nl hockey y x1 x2 x3 if ok2&(id==`i')
    di "rc "_rc " id " `i'
    if _rc ==0 qui {
    replace breakpointx1 = _b[breakpoint] if id==`i'
    replace slopelx1 = _b[slope_l] if id==`i'
    replace sloperx1 = _b[slope_r] if id==`i'
    replace slopex2 = _b[x2] if id==`i'
    replace slopex3 = _b[x3] if id==`i'
    replace r2 = e(r2) if id==`i'
    }
    }

    neither the nl.ado nor the nlhockey.ado files have issued a 'nobreak' commmand

    documention on .do files state that the break key should be active during .do file execution.

    what am i missing?
    thanks in advance.

  • #2
    Hi George,

    I would guess that the problem is caused by the capture statement before the nl command. If you press the break button while Stata is in the nl command, the non-zero return code is captured, rather than stopping the program. Your display command should display return code 1 when you click the break button. You could deal with this code explicitly with an else if statement, like the code below.

    You may also want to look into the statsby prefix, which may be an easier way to accomplish what you're doing here.

    Code:
    forvalues i = 1/315 {
    cap nl hockey y x1 x2 x3 if ok2&(id==`i') di "rc "_rc " id " `i' if _rc ==0 qui { replace breakpointx1 = _b[breakpoint] if id==`i' replace slopelx1 = _b[slope_l] if id==`i' replace sloperx1 = _b[slope_r] if id==`i' replace slopex2 = _b[x2] if id==`i' replace slopex3 = _b[x3] if id==`i' replace r2 = e(r2) if id==`i' } else if _rc==1 { continue, break }
    }

    Comment


    • #3
      mike - yes, it was the capture command. i did not recall/recognize that detail about its operation. thank you. the statsby: prefix is an option, but that requires file saving, sorting, and merging as far as i can tell.
      thank you!
      george

      Comment

      Working...
      X