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.

17 Responses

  1. Hi! Does the usespss ado also exist for stata 15 64bit? or is there another possibility to open sav files?

  2. Can the usespss now be installed in a mac?

  3. Hi! Is there any specific folder where the dataset should be saved?
    My stata says it doesn’t find the .sav dataset which i say it should use.

    • Hi Cristian. Try to change your current working directory to where the dataset is. See -help cd-. Hope this helps.

      • That did it! Thank you so much.
        Does this mean now that every time I wish to open a .sav file, i have to re-set the working directory to the folder where the dataset is located?

    • setting the working directory lets Stata know where it will read and write files. in general Stata allows the complete file path (eg “c:\desktop\my file”. i have not tried whether it works for -usespss-. give it a try…

  4. hi! how do I do it for mac??

  5. Hi Mitch! I have tried stat transfer but some values are truncated. Is there no other way? o *.csv na lang para infix?


    • Check why the values are truncated. Knowing a little bit about the data you are working on, I am guessing that these are the very long IDs that are coded as numeric, but are better off as strings.

  6. Hi Mitch! How do you access spss files using 64-bit Stata? If that is not possible, how do I shift from 64-bit to 32-bit? I’ve re-installed Stata in my laptop and chose 32-bit but the license is for 64-bit so I cannot open Stata using 32-bit. Hope you can help me. Thanks!


  7. I’m trying to install this package using the command below:

    ssc install usespss

    but I get this answer:

    nothing to install

    Any idea of what might be happening ? I just installed Stata 11 IC in my computer so the entire environment is a bit new for me

    Thanks a lot


Leave a Reply