Announcement

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

  • Stata from Command Line: Return non-zero exit code if error?

    Hi All,

    Trying to run stata jobs from the command line (using cygwin, a linux-like interface). The problem I'm running into is that Stata doesn't appear to be return a non-zero exit code when problems arise.

    Current Code:

    stata="/cygdrive/c/Program Files (x86)/Stata12/StataMP-64.exe"
    file="my_dofile.do"
    "$stata" -e do $file || exit 1

    But even if I (intentionally) introduce bugs in the dofile, it runs cleanly from the command-line perspective.

    There a flag to get it to raise errors?

    Thanks!

  • #2
    Found this, which with some tweaking works: https://gist.github.com/pschumm/b967dfc7f723507ac4be

    Seems like should be supported though! Maybe in Stata 15?

    Comment


    • #3
      Anyone know if this has been improved up in Stata 14 or 15?

      Comment

      Working...
      X