How do you save SPSS files to .csv format?

Technote (FAQ)


Question

How do you save SPSS files to .csv format?

Answer

Saving data files out as Comma Delimited (.csv) is now available in SPSS 15.0.

Prior to version 15, tab delimited format was the closest format you could save to a comma delimited.
Here are some work arounds:

For small datasets, you could possibly do this:

WRITE OUTFILE='D:\work\writetest.dat'
/X1 ',' X2 ',' X3.
EXECUTE.

This was a file with three variables, X1, X2, and X3.

The other possibility would be to create (A1) string variables that would hold the commas and insert them between each existing variable, so you could just use the /ALL subcommand in the WRITE command. The actual variable list would be something like:

X1
COMMA1
X2
COMMA2
X3

Then the command could read:

WRITE OUTFILE='D:\work\writetest.dat'
/ALL.
EXECUTE.

Either way there's a little tedium. Try this:


DATA LIST FREE / X1 TO X3 (3A).
BEGIN DATA
A C B B D C C A D C A D C E F C D F
C A D B A C B A C C E A C A B C D A
C A D A E D C A B
end data .

WRITE OUTFILE='D:\work\writetest.dat'
/X1 ',' X2 ',' X3.
EXECUTE

Historical Number

23247

Rate this page:

(0 users)Average rating

Add comments

Document information


More support for:

SPSS Statistics

Software version:

Not Applicable

Operating system(s):

Platform Independent

Reference #:

1475418

Modified date:

2007-10-24

Translate my page

Machine Translation

Content navigation