Another method of writing out raw (ASCII) data from SPSS is through the use of the WRITE command in a Syntax window. Those variables listed in the WRITE command are those which are written to the output raw file. Of course, SPSS needs to know what file to put the raw data into, and this is specified by the OUTFILE= subcommand.
Suppose you have an Active File (or an SPSS Save File which you have brought in to an Active File in an SPSS session) that has 100 observations, and ten variables called:
ID SEX AGE RACE TEST1 TEST2 HEIGHT WEIGHT IQ INCOME
Now, you want to create an ASCII (raw) file containing only three of those variables. This is how your program might look (the OUTFILE subcommand example is for the Windows environment; modify accordingly for use on UNIX or Macintosh files):
write outfile='c:\user\rawvals.dat' / id ' ' test1 ' ' income.
execute.
The example above includes a blank column (' ') between each value that is written out. This is not necessary, but if these blank columns are not specified, some values may be written next to other values without spaces in between. Most software can read ASCII data either with or without spaces between values, but usually it is easier to read ASCII files with spaces between values, commonly called "Space Delimited Data". The example above will create (or overwrite) a file called rawvals.dat in the specified directory (folder), and the file will contain all the values for ID, TEST1 and INCOME, separated from the other values by a single space.
If you have a large number of variables and you want all of them output to the raw file, you can use the WRITE command with the word ALL after the slash, as in:
write outfile='c:\user\rawvals.dat' / all.
execute.
For more details on the WRITE command, please consult the appropriate manual listed at the end of this document.