Announcement

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

  • Stata is running all commands twice

    I am running StataNow/MP 19.5 for Mac (Apple Silicon) Revision 04 Nov 2026. I have a 4-core license, and I'm running on a (rather overloaded) MacBook Pro with an M4 Max chip and 32 MB of RAM. My dataset is 3.2 million observations, about 9.8 GB.

    Stata has started to get cranky: when I execute a series of commands from a do-file (in either do or run mode) Stata has taken to consistently running the block twice in a row. On a fair-sized dataset, this can take a long time, but it also often breaks the programme. For example if the block I'm running contains a line deleting a variable, which on the second (very unwanted) iteration it will tell me varname not found. This massively reduces my productivity, while also testing my patience.

    Has anyone else experienced this? Are there any obvious fixes? [Sorry, I don't know how to make the problem reproducible for forum members.]

  • #2
    This feels like something you should connect with Stata's tech support on. If you wanted to avoid that, I'd probably start with a reinstall of Stata. However, tech support might be able to figure out what is going on and help you repair it without having to reinstall from scratch.

    Comment


    • #3
      Hi Elizabeth Pisani ,

      I tried this in the Stata/MP 16.1 console on a Mac and couldn’t reproduce a block running twice after a single request. Since it happens with your existing block, could you add two lines to it the next time you run it?

      Paste this line immediately before the first command in the block:

      Code:
      noisily display "BEGIN BLOCK"
      Paste this line immediately after the last command in the block:

      Code:
      noisily display "END BLOCK"
      Select the whole block, including those two lines, and execute it once in your usual way. The added lines only print messages, even in run mode. If the original block saves or overwrites files, please use copies for the test.

      In the Results window, look at the lines that say just BEGIN BLOCK or END BLOCK. In do mode, Stata may also echo the display commands themselves.

      If you see BEGIN BLOCK, then END BLOCK, then another BEGIN BLOCK before the “variable not found” error, that would show that the block finished once and started again. If the error appears after just one BEGIN BLOCK, the commands immediately before the error would be worth a look.

      Could you post that short section of the Results window and mention whether you used the Do button, a menu command, or a keyboard shortcut? That would help narrow it down without sharing your dataset.

      Comment

      Working...
      X