3

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?

Community
  • 1
  • 1
Sila
  • 31
  • 1
  • 1
  • 3
  • If you have access to StatTransfer, that will be able to transfer the data labels for you – Eric HB Apr 24 '17 at 16:10
  • Using OMS. See here: http://stackoverflow.com/questions/43524233/vars-to-cases-retain-variable-value-labels-tableau-setup-restructure-data-fo – Nick Ziebert May 06 '17 at 17:56

3 Answers3

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.
TeeCee
  • 5
  • 4
bgukw
  • 51
  • 4
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.

Erdne Htábrob
  • 819
  • 11
  • 29
1

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

Fahad
  • 1,943
  • 22
  • 27