The
Stat/Transfer menu interface is fine for
occasional use or for fine-tuning the
characteristics of your variables, but what if
you need to move the same thirty files each
week? For problems like this and for those
users who just can’t stand mice and menus,
Stat/Transfer provides a command processor.
This text-mode
program will accept your commands in simple
copy-like syntax. For instance:
copy in.sas7bdat
out.sav
will convert the SAS file, in.sas7bdat , to an
SPSS file, out.sav.
You can type such commands directly at the
command processor’s prompt, or you can store
them in a text file (a command file) and
execute them later.
Such deferred executions using command files
can be done
- from the command processor’s prompt: ex myfile
- from the operating system command line:
st myfile.stc
- with Windows, by simply double-clicking
on the command file name from the Windows
Explorer.
- from the Run Program dialog box of the
Stat/Transfer user interface
Further, for quick transfers, at the operating
system prompt you can enter just the name of
the Stat/Transfer program, st, and the input
and output file names. For instance:
st in.sas7bdat
out.sav
will transfer a complete SAS file directly to
an SPSS file, right from the operating system
prompt.
The command processor includes the ability to
move a whole group of files using wildcards.
For instance, the command:
st in\*.sav
out\*.dta
will convert an entire directory of
SPSS files to Stata format and write the
converted files to another directory.
It also gives you the ability to combine
multiple input files into a single output
file.
The command processor will execute other
programs and operating system commands if you
precede their name with DOS, or with the word
‘shell”, or with an exclamation point (!). You
can therefore call programs such as zip from
your Stat/Transfer command files. For
instance, the following sequence of commands
will extract a Stata file from a zip file,
convert it to Access file and then delete the
extracted file:
!unzip data.zip
large.dta
!copy large.dta
out.mdb
!del large.dta
The command processor provides the
ability to execute a ‘where’ command for
record selection, a ’keep’ or ‘drop’ command
for selecting variables and a variety of
commands for specifying transfer options and
the information that is necessary to connect
to ODBC databases.
On Windows platforms, to make ODBC connections
even easier, the command processor provides
the facilities to allow you to be prompted
once for connection information, and then to
save a returned ODBC connection string to disk
in encrypted form so that it can be recalled
for completely automatic and ‘promptless’
re-connections to your database.