In SPSS, is it possible to export a dataset file to .CSV with the value names instead of the value numbers?

☆樱花仙子☆ 提交于 2019-12-21 04:38:29

问题


In my SPSS file, I have a variable called "X". It has four values: 1="dog", 2="cat", 3="hyena", 4="parrot".

If I export my data to a .CSV file, here's what it looks like:

X
1
2
3
4

I want the exported .CSV to look like this:

X
dog
cat
hyena
parrot

is this possible?


回答1:


Yes, it is possible (at least in SPSS 20). In File Menu, choose, "Save As...", in the drop down menu in the dialog box that opens choose "Save as type: 'Comma delimited (*.csv)')", and underneath that select "Save value labels where defined instead of data values" (or hit "Alt-a") and choose "Save".




回答2:


The other answers relate to the GUI, but some people prefer using the syntax editor. If you fall into that category, from the programming perspective, you can do something like:

SAVE TRANSLATE OUTFILE='path\to\file.csv'
  /TYPE=CSV
  /MAP
  /REPLACE
  /FIELDNAMES
  /CELLS=LABELS.

Notice the last line, /CELLS=LABELS. -- If you wanted the values instead, you can change it to (surprise!) /CELLS=VALUES.




回答3:


In my version of SPSS (17), the save window has a checkbox for "Save value labels where defined instead of data values", which will save the accompanying labels rather than numerical values.



来源:https://stackoverflow.com/questions/14076767/in-spss-is-it-possible-to-export-a-dataset-file-to-csv-with-the-value-names-in

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!