Reading SPSS data file into Stata

Is it possible to open an SPSS file (*.sav) directly from Stata? Yes. Thanks for the program -usespss- written by Sergiy Radyakin of the World Bank, which loads a *.sav dataset into Stata preserving variable names and labels. Since -usespss- is user-written, you need to install it first from the Statistical Software Components (SSC) archive, which is Stata’s download site for user-written programs. Installing files from SSC is made easy by using the -ssc install- command; but if you want to read the description of the program first before installing, you may use the -ssc describe- command:

ssc describe usespss
/* Provides a description of the program -usespss */
ssc install usespss
/* Installs -usespss- into Stata */

You can now use -usespss- after installation. The basic syntax for -usespss- (for the full syntax, type: “help usespss”) is:

usespss using filename.sav [, clear saving(filename) iff(condition) inn(condition)]

For example:

usespss using filename.sav
/* loads filename.sav into Stata memory */

usespss using filename.sav, clear
/* clears the existing data in memory and loads filename.sav */

usespss using filename.sav, saving(filename.dta)
/* loads filename.sav and saves it as a Stata file filename.dta */

usespss using filename.sav, clear inn(1/50)
/* loads the first 50 observations in filename.sav */

usespss using filename.sav, clear iff(var1<1000)
/* loads the observations in filename.sav that satisfy the condition var1<1000 */

[Note: The -iff- and -inn- options work in same manner as the Stata qualifiers -if- and -in-, respectively. We have showed some examples how the qualifiers -if- and -in- are used in “Putting observations in order” and “_n _N and bysort.”]

Another way to convert an SPSS to Stata data is to use the software called Stat/Transfer. Or, if you have SPSS, you may save the data as a Stata-formatted file.