Transfers from the Command Processor
Previous Topic  Next Topic 

The basic command used when running the Stat/Transfer command processor is COPY, which has  the following form:

           COPY   infilename.ex1   outfilename.ex2    -x1  -x2    ...

where infilename.ex1 and outfilename.ex2 are the input and output files, respectively and .ex1 and .ex2, are standard extensions used to determine the type of file that is read and written.  The file names can be complete file specifications.

An alternative for specifying the file type is to use a file-type tag instead of a standard extension.

Parameters -xi  following the file names allow some options to be selected, such as selecting tables and pages, optimization of variables or controlling messages from Stat/Transfer.

You can give additional commands before you give the COPY command.  These allow you to select cases and variables, to manually change output variable types, to set a number of options and to use other commands.  (Note that these commands can be given only at the Stat/Transfer prompt or in a command file or in a startup fileThey cannot be used when running interactively from the operating system prompt.)

If no commands for selecting cases or variables are given, then by default, all of the variables and cases will be transferred.

For example, to copy all of the variables and all of the cases from an Excel file, indata.xls, to a SAS file, outdata.sas7bdat, type:

   copy  indata.xls  outdata.sas7bdat

where the file type is given by using standard extensions.

Instead of entering commands directly, you can store them in a command file and execute that file at the Stat/Transfer prompt.

Wildcard Transfers

Wildcards can be used to copy multiple files in one transfer. For example:

   copy    in/*.dta    out/*.sas7bdat

will convert all of the Stata files in the directory /in to SAS files in the directory /out.

Standard wildcards work in the input file ('?' and '*' ).  The output filename should always be specified with an asterisk and will be consist of the input filename, with the new extension.

We recommend that you use wildcard specifications with an input directory that contains just the files you wish to transfer.  To avoid the possibility of overwriting existing files or of being prompted about this possibility, the directory should be empty on the output side.  You may also specify the '-y' parameter, to suppress prompting, but you should do so with extreme caution.