How can I convert other packages' files to Stata format data files?
|
Title
|
|
Converting other format files into Stata dataset files
|
|
Author
|
Shannon Driver, StataCorp
|
|
Date
|
May 2003; updated July 2011
|
The most popular spreadsheet format is the Microsoft Excel®
worksheet. You can use the import excel command to read .xls and
.xlsx files into Stata.
If your data are stored as a SAS XPORT file, you can use the
import sasxport command to read this file into Stata.
Most spreadsheet and statistical software packages are able to export data as
ASCII text files containing fixed-format, free-format, comma-delimited, or
tab-delimited data. If your package has this feature, you should be able to
export the data, and then read the data into Stata using the
infile,
infix, or
insheet
command, depending on the file format. For information about infiling
data and the method you should use, see the help file for
infiling.
Another way to convert your data to Stata format is to register your data as
an ODBC source and then use Stata's
odbc
commands to read the data directly into Stata.
Alternatively, you could purchase a separate data conversion package, such
as Stat/Transfer, to convert the files from other packages directly into
Stata format files without first having to save the files as ASCII text
files. You may want to use one of these programs because they usually
preserve your value labels, variable labels, and data types, whereas creating
and reading ASCII text files into Stata may not do this without extra work.
Additionally, you will need to use one of these packages if your spreadsheet
or statistical software package does not allow you to export the data as an
ASCII text file. Stat/Transfer supports a variety of different packages.
For additional information and a listing of packages supported by
Stat/Transfer, or to purchase a copy of Stat/Transfer, click
here.
|
FAQs
What's new?
Statistics
Data management
Graphics
Programming Stata
Mata
Resources
Internet capabilities
Stata for Windows
Stata for Unix
Stata for Mac
Technical support
|