Export .csvout of SPSS

Lazar

Phineas Packard
#1
HI All,

For a training course I have to leave R and dabble in SPSS. I have not used the programme in sometimes and cannot remeber even some very basic stuff.

Basically I need to export an SPSS file to a .csv file in which there are no headings, no string variables and missing are represented in the .dat file by a fullstop ".".

Here is the syntax I have so far what I want except the missing data bit.

Code:
*Mplus does not like variables that are text so drop them.
SAVE TRANSLATE OUTFILE='C:\Users\30016475\Dropbox\myData.csv'
  /TYPE=CSV  
  /MAP
  /REPLACE
  /CELLS=VALUES
  /DROP=Name.
*The above line is where I got rid of the string variable
Here is what I want
Code:
1,3,4,2,5
2,4,5,3,.
3,.,.,4,3
 
#2
This is one way to achieve what you want but I can't promise that it's the best way. Essentially, you want to use the 'CELLS=LABELS' command rather than 'CELLS=VALUES'. The CELLS=LABELS will default to values if labels aren't defined so first thing to do is to strip out all the value labels, then to define all missing values and label with '.' e.g.:

Code:
recode all (missing=-999).
exe.

value labels / all
-999 '.'
.

*Mplus does not like variables that are text so drop them.
SAVE TRANSLATE OUTFILE='C:\Users\30016475\Dropbox\myData.csv'
  /TYPE=CSV  
  /MAP
  /REPLACE
  /CELLS=LABELS
  /DROP=Name.
*The above line is where I got rid of the string variable.
 
Last edited: