Most statistical softwares nowadays are able to convert their files to a wide range of other packages. Perhaps it is the reason for the discontinuity of old converter bundles like SAS Transport and DBMS. Interesting, however, Stata, a quite popular statistical package, still lack built-in support for exporting and importing files among concurrent softwares like SPSS and JMP. Things can be even worse if one needs to translate files to-or-from minor packages like Octave, HLM, and Statistica, for instance. Recently, user-written algorithms came up to help Stata users to overcome such a gap. This user-wrapper named UseSPSS was written by Sergiy Radyakin. Nonetheless, there are still limitations on the version of SPSS you can load into Stata. [Edited] As Sergiy Radyakin himself commented bellow, the limitations are related to the Stata support and not to the UseSPSS bundle.
A good news is that R provides a library named “foreign” that can translate files virtually from one to any other software. That is, you can simply load a file into R and then export to any other format. You are not limited to Excel(r) and text files like .txt, dat, and .csv. Hence, even if you don’t know how to handle analysis using R, you can use this free-for-all yet robust package to translate files to your favour statistical software. You can actually save more than $180 with licensing a version of the StatTranfer, in my opinion, the best file converter available in the market. The StatTransfer itself also explains why Stata supplies so little functions to import and export files.
In what follows I show step-by-step how to use R to translate files from SPSS into Stata format for free.
Step 1: install R from
Once you have installed R you can import a file and export it straightforwardly to many other packages, or just convert to universal .txt. I will comment one way (for dummies) to proceed in the following paragraphs.
Step 2: install the package Rcmdr from the Package Menu by selecting “Install Packages” or by typing:
install.packages("Rcmdr", dep = TRUE)
Step 3: open up the Rcmdr package by evoking it typing:
Step 4: When Rcmdr loads it should load a new window–the R Commander window. Then, select from the menu Data -> Import Data -> from SPSS data set. Name your data set as you like and select ‘ok’. Now you must find your .sav file.
An alternative you may know is doing by hand without Rcmdr window interface as in the following:
yourdata = read.spss(file.choose(), use.value.labels = FALSE, to.data.frame = TRUE)
This command will setup variables to not convert value labels. Which may optimize the cleaning task for later analysis. In addition, the second statement assure the data will remain as a rectangular table rather than converting to lists, vector or matrixes.
Step 5: If there has been no problem up to now you should have a data set in the memory. You can check it doing some tabulation or just typing:
Finally, you can export the data to Stata (.dta) with the next command:
It is done and you can check out your new file in your home directory. If you don’t know where is your home directory, just type in the R window
getwd(), it will print the path to you. Finally, there are many specifications you might want to arrange when loading or saving you files. Just learn more about it by typing
?foreign in the prompt of R.