Command Processor

Q.  When I go to the Start menu in Windows and click on Stat/Transfer, I see something called Stat/Transfer Command Processor.  What is it?

 

A.  The Stat/Transfer Command Processor is a separate program that lets you transfer files without using the user interface, but rather through simple commands.  It can be invaluable if you have a large number of repetitive transfers or if you wish to do batch transfers.  It can be reached from any platform by typing 'st' at the operating system prompt.

 

The command processor has been integrated into the user interface, so that you can generate command files automatically and edit and run command files from the Run Program tab.  Check the “Command Processor” section of the manual for complete details.

 

Q.  I have an Access database with over one hundred tables.  I want to convert these all to Stata files.  What is the easiest way to do this?

 

A.  First create a directory for your output files (out, for example).  Then enter the Command Processor (see Question 1).  If your input file is c:/data/my.mdb (assuming a Windows machine) and your new output directory was c:/data/out, you could use the command

 

        copy   c:/data/my.mdb   c:/data/out/*.dta   /t*

 

The '/t*' modifier in this command tells Stat/Transfer to copy all of the tables from my.mdb to the destination out.  The output files will be automatically named with the name of the table and the extension .dta.

 

Q.  I have fifty dBASE files I would like to move to SAS, what is the easiest way to do this?

 

A.  Assuming your dBASE files are in /data/dbase and you would like your output in /data/sas, you can do this in a single command:

 

         copy   c:/data/sas/*.dbf   c:/data/sas/*.sas7bdat

 

Q.  The user interface has lots of options.  The command processor just has that blank prompt.  How do I set some options in there?

 

A.  You can do anything in the command processor that you can do through the user interface.  The simplest way to learn to use the command processor is to run a transfer with the user interface and, when you are done, press the Save Program button to generate a command file for the command processor.  Then examine the program from the Run Program tab. All of the options and commands are thoroughly documented in the online help or in the manual.

 

Q.  How do I set my options permanently so that I don't have to enter SET commands every time I start up the command processor?

 

A.  Put your SET commands in a file called profile.stcmd, located in the same directory as Stat/Transfer.

 

 

Q.  I would like to run a file of options that are not the same each time.  How do I run a copy command from the operating system, while at the same time executing a file of option commands.

 

A.  Put your SET commands in any file, e.g. opt.stcmd, and then execute Stat/transfer with the special -ex switch.  For example:

 

    st my.xlsx out.sas7bdat -exopt

 

which will run the command in opt.stcmd before transferring my.xlsx to out.sas7bdat.

 

If you are a Stata user, you can use the same technique with the stcmd.ado file.