Export data to other statistical packages
outdat[varlist] using filename [, replace type(packagelist)] nostring listwise
outdat writes data to a disk file in ASCII format, a format that can be read by other programs. To read the data into other programs you need a data dictionary, which is also produced by outdat.
The ASCII file written by outdat is called filename with the extension dat. The data dictionary is also called filename, but with the extension for the data dictionary of the specific software you want to use. If you want to use SPSS, for example, the dictionary is called filename.sps.
To transfer data to a SQL-Database outdat creates a file, containing the SQL INSERT instructions to load each row into a preexisting table. The name of this table is the filename without the path of the file. That is, using ~/path/to/file/xyz implies "xyz" as the name for the table. To produce SQL-Tables check out the option create.
It must be noted that some Stata features (long variable names, case sensitivity, etc.) cannot be handled in all packages. You may use rename before executing outdat for such data. But also note that it is easy to edit the dictionary to fit more specific requirements of the software to which you transfer.
replace permits outdat to overwrite an existing filename.dat and dictionary file. As always replace cannot be abbreviated.
type(packagelist) is used to specify the software packages you want to transfer to. You specify the software packages by their names in lower case letters with spaces in between. To get data dictionaries for SPSS and Stata you have to specify type(spss stata) for example.
spss is the default if you do not specify this option.
The following packages can be specified:
limdep Limdep (not tested!) spss SPSS sql SQL-Databases (Oracle, mySQL) stata Stata rats RATS
This list will be expanded sooner or later.
nostring forces outdat not to transfer string variables. This is useful as some packages cannot handle string variables.
listwise is used to transfer only observations with no missing values on any of the specified variables.
upper is used to transfer variable names in upper case. Without upper the variable names are transfered as they are. For type(sql) this also changes the case of SQL-commands and filenames.
create has a special meaning only with type(sql). type(sql) without create produces a script to input the data in a preexisting table of the SQL Database. With create you get another script to setup the table itself. Note that create does not produce an error if you use it together with another package than SQL. It simply gets ignored.
outdat using mydata outdat mpg hdroom foreign using auto, t(spss) outdat using mydata, t(sql stata) nostring listwise create
The extensions for RATS and SQL builds on torats and tosql written by Christopher Baum.
Also see On-line: help for outfile, infile