UCLA Academic Technology Services HomeServicesClassesContactJobs
Help the Stat Consulting Group by giving a gift             
Loading

How do I use a SPSS data file in Stata?

1. Using SPSS software

SPSS supports Stata data files and can easily save an SPSS file as a Stata file through the point and click interface or syntax.  Using the pull down menus select File then Save As... and then for Save as type select the type of Stata file needed.  Type the file name and click Save to save the Stata file. 

To use SPSS syntax use the save translate command as seen below.

save translate outfile='C:\data\hsb2.dta'.
Data written to C:\data\hsb2.dta.
11 variables and 200 cases written.
[output omitted for space]

2. Using Stat/Transfer software

It is fairly straightforward to convert an SPSS data file to Stata via Stat/Transfer. Note: If the file being transferred has more than 2,047 variables and you are going to use Stata/SE, the data file should be converted to Stata/SE, in which case you will need to select Output File Type: Stata/SE.

3. Using Stata user-written program usespss

A Stata user-written command called "usespss" works under Windows environment. You can download it via "findit usespss". Here is an example.

usespss using hsb2.sav, clear

One can also examine the data set before reading it into Stata and here is an example.

desspss using hsb2.sav
DESSPSS Report
==============
SPSS System file: hsb2.sav
Created (date): 12 Jun 07
Created (time): 15:29:10
SPSS product: @(#) SPSS DATA FILE MS Windows Release 14.0.1               
File label (if present):                                                                 
File size (as stored on disk): 4029 bytes
Data size: 2592 bytes
Data stored in compressed format
This file is likely to originate from a Windows platform (LoHi byte order)

Number of cases (observations): 200
Number of variables: 11
Case size: 88 bytes
----------------------------------------------------------------------

Variables:

id       female   race     ses      schtyp   prog     read     write    math     science  SOCST

How to cite this page

Report an error on this page or leave a comment

UCLA Researchers are invited to our Statistical Consulting Services
We recommend others to our list of Other Resources for Statistical Computing Help
These pages are Copyrighted (c) by UCLA Academic Technology Services


The content of this web site should not be construed as an endorsement of any particular web site, book, or software product by the University of California.