| PRISM's Quick Guide to Importing Data* |
|
|
|
|
|
|
|
| File Extension |
Type of File |
Importing to SPSS |
Importing to Stata |
Importing to R |
| .sav |
SPSS data file |
Already in SPSS format |
In SPSS use "Save
As" to save as a Stata .dta file |
Use foreign package |
| .sps |
SPSS syntax file |
Helps label and define
non-SPSS formatted data files |
If a file of this nature
accompanies your data (probably in a .txt format), then you can use it to
label your data. Just tell it where in your computer's directory to find the
data. |
|
| .por |
SPSS portable file |
Already in SPSS format |
In SPSS use "Save
As" to save as a Stata .dta file |
Use foreign package |
| .txt |
Text file |
Use "Read Table"
command |
Use "Import
ASCII" data |
Use "read.table"
command |
| .csv |
Comma delimited file |
Use "Read Table"
command |
Use "Import
ASCII" data - note the proper delimiter |
Use "read.csv"
command |
| .raw |
Raw text file |
Use "Read Table"
command |
Use "Import ASCII
unformatted" data |
Use "read.table"
command |
| .xls |
Excel formated file |
Use "Read Table"
command |
Use "Import
ASCII" data after "Save As" .csv file in Excel |
Use "read.xls"
package and command |
| .dat |
General data storage file |
Use "Read Table"
command |
Treat like ASCII import |
Use "read.table"
command |
| .dta |
Stata data file |
Use Stat-transfer |
Already in Stata format |
Use foreign package |
| .do |
Stata syntax file |
|
If a file of this nature
accompanies your data (probably in a .txt format), then you can use it to
format your data to Stata specifications. Just tell it where in your computer
to find the data file and the dictionary file. |
|
| .smcl |
Stata log file |
|
|
|
| .dct |
Stata dictionary file |
Helps label and define
non-Stata formatted data files |
If a file of this nature
accompanies your data (probably in a .txt format), then you can use it to
label your data with the help of the do file above. |
|
|
|
|
|
|
| *These are just some quick notes based on common questions to
the PRISM fellows. For a more extensive guide please refer to the PRISM
brownbags: An Introduction to Stata and An Introduction to R and/or the other references below |
|
|
|
|
|
| Good References |
|
|
|
| PRISM's Intro to R |
|
|
| PRISM's Intro to Stata |
|
|
| Importing & Exporting in R |
|
|
| Foreign Package in R |
|
|
| Google Search |
|
|
|
|
|
|
|
|