How to run a batch job.

  EDS > Stat/transfer Batch
printer friendly version Print
Page

If you have dozens of files that need converting, you can possibly save time but preparing and running a batch job.

First prepare an ascii file containing the set and copy commands you want to execute. The file extension must be ".stc".

From the Start menu, go to StatTransfer 9 and then to StatTransfer Command Processor. This opens a DOS type window.

Type the command "ex" followed by the name of your .sct command file. For example:

   ST: ex D:\MyDocs\sue\many.stc

Note that for Stata, the default transfer version is Stata 10.

Here are some examples of command files:

Copying Excel files into stata while taking a geographical subset of the data. The Stata datasets will be in version 9.

set write-old-ver Y
where level="DISTRICT"
copy PCA3501.xls PCA3501_dist.dta
where level="DISTRICT"
copy PCA3502.xls PCA3502_dist.dta
where level="DISTRICT"
copy PCA3503.xls PCA3503_dist.dta

Copying multiple Excel files with multiple sheets in multiple directories to Stata in a single directory. All of the sheets in any one Excel files are concatenated into a single Stata file. Any blank lines are skipped.

set concatenate-pages Y
set wks-blank-rows skip
copy D:\MyDocs\sue\Nyanza\*.xls       D:\MyDocs\sue\Africa\*.dta
copy D:\MyDocs\sue\RiftValley\*.xls   D:\MyDocs\sue\Africa\*.dta
copy D:\MyDocs\sue\Western\*.xls      D:\MyDocs\sue\Africa\*.dta
copy D:\MyDocs\sue\Nairobi\*.xls      D:\MyDocs\sue\Africa\*.dta