Sunday, June 17, 2012

3 Ways of Loading SPSS (sav) files into Stata

1. The easiest and most straightforward way is using the user written package usespss.

  This package however only works for 32 bit windows.

2. The next easiest method if you have it available is using StatTranfer which allows for the conversion of many types of files from one format to another:

  A license could be had for as little as $59 if you are a student.

3. The last option takes a few more steps but is free.

  a. First install R

  b. Next install the package Rcmdr from the Package Menu by selecting "Install Packages" [Packages>Install Package(s)>Select Closest Mirror>Rcmdr].

  c. Next open up the Rcmdr package by going to the menu [Packages>Load Package...>Rcmdr]

 d. When Rcmdr loads it should load the R Commander window.  Select from the menu [Data>Import Data>from SPSS data set]

 e. Name your data set Data1 [select 'ok'], now find your sav file.

 f. If there has been no problem up to this point you should now have a data set in memory called Data1.

 g. Now you can export to a dta file with the following command:
write.dta(Data1, "File Directory/File Name.dta")

(In R you need to specify directory dividers as either / or \\ not \.)


  1. You can do the R method as an ado file (at least on Mac/Linux, not sure about Windows)

  2. Does the R method actually translate the SPSS code to STATA code?

  3. Note that you can also save an SPSS data file as a Stata data set, if you have SPSS.
    If you don't, and just have the .sav file, then one of the above methods would work.
    I would never have thought about going through R!

  4. Thanks a lot for the simple description of the steps in R, works flawlessly for me!


  5. Thanks for detailed descpirtion, it worked fine for me, even I had no idea what R is.
    I had a little problem on my way as i wrote a new .dta file name, but I have solved it by creating a mini .dta file with two first variables from SPSS file and then repeating export from R to that .dta file.
    For them, who want to create a new STATA file with data from SPSS file, the first step should be to create a .dta file nad then write to that file.

  6. Thanks a lot :-) R worked for me too. All the best

  7. Good job! Note that there is a new version of -usespss- that works in 64-bit Stata (Windows only), with the additional advantage of not losing variable labels (unlike with the R method, as far as I know). It's a beta, but has worked flawlessly for me so far, see

  8. Thank you so much!!! I cannot believe I could do all of that without knowing the first thing about R. Your step-by-step is amazing!!!

  9. Thanks a million for this - it worked a dream. I used the R method and it took me a while but the instructions are clear and easy to follow, even for complete eejits.

  10. Many thanks! The R steps work so good! Thanks a lot.

  11. The R steps are perfect. Thanks for sharing! FYI, also works with .por for portable SPSS files!

  12. "c. Next open up the Rcmdr package by going to the menu [Packages>Load Package...>Rcmdr]"

    Sorry, I don't have anything like that. In the tabs I see Packages. When I click on Packages, I get Package Manager, Package Installer, and Data Manager in that order. Where is "Load Package?"

  13. This worked with no problems. Thank you thank you thank you.

  14. Could you please be more specific re: step 'g' using the R method? I.e. if I'm using a Mac, what is the file directory? When I imported the SPSS data using XQuartz, where was this file written/saved? Is it in an XQuartz directory? An R directory?


  15. Thanks a lot Francis, it worked with R. Best wishes, Markus