Announcement

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

  • stata batch mode: xxx.do was interrupted. Would you like the batch job to continue

    I try to use batch mode in stata
    Code:
    D:\s18\StataMP-64.exe /b do "F:\OneDrive\N\1mpg.do"
    But I often encounter this error:
    Code:
    "1mpg.do" was interrupted. Would you like the batch job to continue? yes or no?
    It pops up a dialog box and asks me to choose yes or no. If I click yes, it will continue to execute until I get the desired result, but if I choose no, it will end. I want to know, why does this dialog box appear, and how can I set it to choose yes by default?

    If the content of my do file is as follows:

    Then this dialog box will not appear.
    Code:
    sysuse auto,clear
    global Ys "mpg price"
    forval i=1/300 {
       foreach Yi of global Ys{
          dis "i"
       }
    }
    If the content of my do file is as follows:
    Code:
    sysuse auto,clear
    global Ys "mpg price"
    forval i=1/300 {
        foreach Yi of global Ys{
            reg "Yi" trunk length turn displ gear forei
       }
    }
    Then this dialog box will appear.

    Is there anything special about the most basic reg command?

  • #2
    It’s interrupted because it encounters an error. The error arises because you need to use single quotes to expand a macro (e.g. `Yi'). Using double quotes is used for literal strings, which is why your first block of code runs (though it gives you the wrong output).

    Comment


    • #3
      The error arises because you need to use single quotes to expand a macro (e.g. `Yi').
      Clarification: to expand a macro you do not use ordinary single quotes ('Yi'). To expand a local macro, the opening quote is `, not '. The closing quote is the ordinary single quote '. If you use ordinary single quotes ('Yi '), you will again get the error message.

      Comment


      • #4
        Clyde is correct, I showed the correct quotes but have not clarified the left quote is the back-tick.

        Comment


        • #5
          Thanks! I have corrected the typographical error. It appears that this behavior is a characteristic of the Windows operating system. Additionally, I am curious to inquire whether it is possible to pass parameters in batch mode for a `do` file to accept and utilize. Could you recommend comprehensive resources for understanding this aspect?

          Comment

          Working...
          X