'Exporting SPSS variable labels

I am using Stata for data analysis but had to convert the dataset I am using from SPSS, which includes variable labels, by saving it as a .csv file. However, the variable labels were not exported to Stata in the process.

I have followed the advice in this question (In SPSS, is it possible to export a dataset file to .CSV with the value names instead of the value numbers?) but this one only refers to the value labels, not the variable labels.

How do I export the SPSS variable labels?



Solution 1:[1]

You can not do it with csv. In SPSS with save as (instead of export data) you can save your dataset as dta, in Stata format. Just chose the most recent Stata format your SPSS knows. I think then you have both the value labels and the variable labels.

Solution 2:[2]

I realize this is an old question, but just in case someone else is looking for how to do this.

If you export your SPSS file to Excel, there is an option to save variable labels instead of variable names as the column headers. It's clunky, but you can:

1) Export to Excel once with variable names,

2) Export to Excel once with variable labels

3) Paste special -> transpose the two next to each other

And you'll get a crosswalk from variable name to variable label

Solution 3:[3]

  1. You can export the variable labels using the DISPLAY DICTIONARY. SPSS syntax. You can also find this in the menu: File -> Display Data File Information -> Working File. A table with the category labels of all variables appears in the output window.
  2. You can export the contents of the output window into formats understood by other software, including html, txt, xls.
  3. Then you can extract the labels from the exported file and re-format them for use in Stata. I would use txt export and a Python script to produce a Stata program.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Erdne Htábrob
Solution 2 Fahad
Solution 3 TeeCee