The SAVE command
To save the current dataset to a file named "Survey.sav", you would simply write:
SAVE OUTFILE="Survey.sav".
(.sav is the extension for SPSS data files, for this reason also called SAV files).
Additional options useful for data management tasks
The SPSS command corresponding to
has a number of useful options for data management purposes .
SAVE OUTFILE='filename'
[/KEEP=varlist]
[/DROP=varlist]
[/RENAME=(old.varlist=new.varlist)...]
[/MAP]
- /KEEP=varlist: an option
that lets you write only the listed variables, all others
will be ignored. In addition to this task,
/KEEP
can also be used to place variables into a different sequence
(variables are written in the order they appear on the variable list).
- /DROP=varlist
is similar, except that you do not list the variables you want
to keep, but those that you would like to drop.
- /RENAME (varlistold = varlistnew)
can be used to change the name of a variable while writing the dataset to
a file. The old name list and
the new name list must of course contain the same number
of variables. Note that the new names are only stored in the file, the names
in the current are not affected.
- /MAP displays a list of variables saved to the file, and, if /RENAME has been used,
the old and new names.
The same options are available with the
GET FILEcommand.
Some commented examples
- SAVE OUTFILE "survey"/KEEP=GENDER AGE PART.
Only the variables on the list will be written to "survey.sav".
- SAVE OUTFILE "survey"/KEEP=PART AGE GENDER.
As above but the first variable in the new file will be PART
(changing the sequence).
- /RENAME=(d07 d08 = gender age)
the original variable names will be changed, i.e. "d07" will be
named "gender" and "d08" "age".
- /RENAME=(sex, age, housing educ educ1 educr = DEMOG1 to DEMOG6)
is similar but uses the "TO" convention for the new variable list, i.e.
DEMOG1, DEMOG2 etc are implied.
Advanced options
SAVE OUTFILE='filename'
[/UNSELECTED=[{RETAIN} ¦{DELETE} ]
[/VERSION={3 ¦ 2}]
[/PERMISSIONS {READONLY ¦ {WRITEABLE}}]
[/{COMPRESSED ¦ {UNCOMPRESSED}}]
[/NAMES]
- /UNSELECTED=
Determines what to when observations are currently
filtered (temporary selection); by default
RETAIN is used;
DELETE deletes them.
(see ,
if unsure what filtering observations means.)
- /VERSION=
Use /VERSION=2 if the file
needs to be compatible with SPSS versions 7.5 or earlier.
- /PERMISSIONS
/PERMISSIONS=READONLY creates
a file that can only be read, unless you change this property
later. Default is /PERMISSIONS=WRITEABLE.
- /COMPRESSED or /UNCOMPRESSED
Save the file in compressed (space saving, but requires more time) or
uncompressed form (bigger files, faster). This is fact only of
interest for very big files; the default is set to compressed
(but this can be changed in .
- [/NAMES]
List the 8 character long names that will be used in versions earlier
than 12.0 (when up to 64 character long names were introduced); useful
for compatibility only.
See also
SPSS lets you also save to a large number of other file types: spreadsheets,
other statistical software etc. With the
dialog you simply select the type you want. If you would like to perform
the same operation, with often additional options, see the
SPSS manual and look up the
SAVE TRANSLATE command.