Announcement

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

  • Running Stata do-files through the Command Prompt in Windows 2008?

    I'm basically planning on playing around with different ways of running do-files and optimizing the utilization of 8 cores. To start, I'm figuring that the command prompt would know how to better allocate the computer's resources than running multiple instances of Stata simultaneously.

    Problem is, I can't figure out the syntax. Nothing I've found online is working. The program's location is:

    C:\Program Files (x86)\Stata12\StataMP-64

    I also believe I have access to Windows 2003, if anyone happens to know how to do it through 2003 instead.

  • #2
    See the Stata FAQ "How do I run Stata for Windows in batch mode?"

    Comment


    • #3
      That's exactly the FAQ I was using. For this test run, I'm just trying to get the command prompt to show that it has worked properly, and it hasn't:

      Code:
      version 8.2
      #delimit ;
      capture log close;
      capture drop _all;
      set more off;
      set mem 2900m;
      
      set obs 20;
      gen int didthiswork = 0;
      
      capture "Y:\Jess\Fussin Around\IT WORKS.dta", replace;
      Although I didn't know the exact issue when I originally posted, I do now: when I run the do-file normally through the File > Do option in Stata, it works perfectly, saving the .dta to the specified location. But if I run it through the command prompt, it doesn't capture/replace anything to said location.

      Comment


      • #4
        Based on your syntax, you left out the "save" command, so I don't see how it could run at all.

        Batch mode works fine. One thing they left out of the documentation is to use actual Windows batch files to execute the Stata commands.

        Comment


        • #5
          You're right, it doesn't work without "save." I must have pasted my code in here before adding "save."

          So essentially, I should be moving my script to a plain text .cmd file and adjusting the location for my command input accordingly?

          I added a simple display command and then saved the file as doesitwork.cmd. I did end up getting an output file, but it was supposed to be "Y:\Jess\Fussin Around\IT WORKS.dta" and it came out as "H:\doesitwork.txt" instead, with only this in it:

          Code:
            ___  ____  ____  ____  ____ (R)
           /__    /   ____/   /   ____/
          ___/   /   /___/   /   /___/   12.1   Copyright 1985-2011 StataCorp LP
            Statistics/Data Analysis            StataCorp
                                                4905 Lakeway Drive
               MP - Parallel Edition            College Station, Texas 77845 USA
                                                800-STATA-PC        http://www.stata.com
                                                979-696-4600        [email protected]
                                                979-696-4601 (fax)
          
          3-user 4-core Stata network perpetual license:
                 Serial number:  50120547573
                   Licensed to:  Username
                                 Organization

          Comment

          Working...
          X