Overview (SAVE command)

SAVE produces a data file in IBM® SPSS® Statistics format, which contains data plus a dictionary. The dictionary contains a name for each variable in the data file plus any assigned variable and value labels, missing-value flags, and variable print and write formats. The dictionary also contains document text that was created with the DOCUMENTS command.

XSAVE also creates IBM SPSS Statistics data files. The difference is that SAVE causes data to be read, while XSAVE is not executed until data are read for the next procedure.

See SAVE TRANSLATE for information about saving data files that can be used by other programs.

Options

Compatibility with Earlier Releases. You can save a data file that can be read by releases prior to 7.5.

Variable Subsets and Order. You can use the DROP and KEEP subcommands to save a subset of variables and reorder the variables that are saved.

Filtered Cases. If filtering is in effect, you use the UNSELECTED subcommand to specify inclusion or exclusion of filtered cases. By default, all cases are included.

Variable Names. You can use the RENAME subcommand to rename variables as they are copied into the IBM SPSS Statistics data file. Long variable names are supported when explicitly specified on the /VARIABLES and /STRINGS subcommands. Variable names are truncated to 8 bytes when they are referenced through a vector in the /NAMES subcommand.

Variable Map. To confirm the names and order of the variables that are saved in the data file, use the MAP subcommand. MAP displays the variables that are saved in the data file next to their corresponding names in the active dataset.

Data Compression. You can use the COMPRESSED or ZCOMPRESSED subcommand to write the data file in compressed form. You can use the UNCOMPRESSED subcommand to write the data file in an uncompressed form. See the topic COMPRESSED, UNCOMPRESSED, and ZCOMPRESSED Subcommands (SAVE command) for more information.

Encryption. You can use the PASSPROTECT subcommand to save the file as encrypted, allowing you to protect confidential information stored in the file. See the topic PASSPROTECT Subcommand (SAVE command) for more information.

Basic Specification

The basic specification is the OUTFILE subcommand, which specifies a name for the data file to be saved.

Subcommand Order

  • Subcommands can be specified in any order.

Syntax Rules

  • OUTFILE is required and can be specified only once. If OUTFILE is specified more than once, only the last specified OUTFILE is in effect.
  • KEEP, DROP, RENAME, and MAP can each be used as many times as needed.
  • Only one of the subcommands COMPRESSED, UNCOMPRESSED, or ZCOMPRESSED can be specified per SAVE command.

Operations

  • SAVE is executed immediately and causes the data to be read.
  • The new data file dictionary is arranged in the same order as the active dataset dictionary, unless variables are reordered with the KEEP subcommand. Documentary text from the active dataset dictionary is always saved unless it is dropped with the DROP DOCUMENTS command before SAVE.
  • New variables that were created by transformations and procedures that occurred prior to the SAVE command are included in the new data file, and variables that were altered by transformations are saved in their modified form. Results of any temporary transformations that immediately precede the SAVE command are included in the file; scratch variables are not included.
  • The active dataset is still available for transformations and procedures after SAVE is executed.
  • SAVE processes the dictionary first and displays a message that indicates how many variables will be saved. After the data are written, SAVE indicates how many cases were saved. If the second message does not appear, the file was probably not completely written.