How to Submit a Do-file in Batch Mode

The benefits of batch mode are many: 1. Your code is processed faster. 2. Your log and output windows are automatically saved in *.log and *.lst files. 3. Every time you submit your program you know you are starting off with a clean slate. 4. All your friends will think you're cool.

In Stata your results window is automatically saved to an ASCII text log file.  You can choose to have your results saved in a *.smcl file if you use the log using command in your do-file and specify a filename that does not have the extension of ".log".  The smcl file documents the results window down to the colors the text is printed in.  To do this Stata uses smcl tags which are a lot like html tags.  The only useful way to view this file is to use Stata's viewer.  If you specify that you want your file to be saved as a *.log file, then it will be saved as a normal ASCII text file without the smcl tags.


 

SAS

Stata

In Linux/UNIX at a prompt type:
sas myprogram.sas 
In Linux/UNIX at a prompt type:
stata -b do mydofile.do
In Windows right-click on the program file listed in the folder that you want to submit and choose "Batch Submit". In Windows you right-click on the do-file listed in the folder that you want to submit and choose "batch" if it is available.  If it is not listed, you can add the following to your folder options file types listing for files that end in ".do" if you are using Windows XP:
C:\Stata\[whatever your Stata executable file is named].exe /m40 /b do "%1" 
"/m40" sets the memory to 40 megabytes.

If you are using a more current version of Windows you can setup a "Stata batch" icon in your SendTo directory: C:\Users\MyUserId\AppData\Roaming\Microsoft\Windows\SendTo .  The AppData directory is likely to be a hidden directory.  Create a shortcut to the Stata executable you want to run and then edit the shortcut by right-clicking on it and choose Properties.&nbps; Then have the Target box have the same settings as shown above but without the "%1"
C:\Stata\[whatever your Stata executable file is named].exe /m40 /b do

Then edit the "Start in" box to be whatever directory you would prefer to have as the current directory for your Stata batch session.  Then when you want to run a do-file in batch mode, you need to right-click on the file and chose SendTo and then click on the name of the shortcut you created.

Wink Plone Theme by Quintagroup © 2013.

Personal tools
This is themeComment for Wink theme