Overview (XSAVE command)

XSAVE produces IBM® SPSS® Statistics data files. IBM SPSS Statistics data files contain 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 created with the DOCUMENTS command.

SAVE also creates IBM SPSS Statistics data files. The principal difference is that XSAVE is not executed until data are read for the next procedure, while SAVE is executed by itself. Thus, XSAVE can reduce processing time by consolidating two data passes into one.

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

Options

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

Variable Names. You can rename variables as they are copied into the data file using the RENAME subcommand.

Variable Map. To confirm the names and order of the variables saved in the data file, use the MAP subcommand. MAP displays the variables 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 (XSAVE 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 OUTFILE specification is in effect.
  • KEEP, DROP, RENAME, and MAP can be used as many times as needed.
  • Only one of the subcommands COMPRESSED, UNCOMPRESSED, or ZCOMPRESSED can be specified per XSAVE command.
  • Documentary text can be dropped from the active dataset with the DROP DOCUMENTS command.
  • XSAVE cannot appear within a DO REPEAT—END REPEAT structure.
  • Multiple XSAVE commands writing to the same file are not permitted.

Operations

  • Unlike the SAVE command, XSAVE is a transformation command and is executed when the data are read for the next procedure.
  • 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 XSAVE.
  • New variables created by transformations and procedures previous to the XSAVE command are included in the new data file, and variables altered by transformations are saved in their modified form. Results of any temporary transformations immediately preceding the XSAVE command are included in the file; scratch variables are not.
  • IBM SPSS Statistics data files are binary files designed to be read and written by IBM SPSS Statistics only.
  • The active dataset is still available for transformations and procedures after XSAVE is executed.
  • XSAVE processes the dictionary first and displays a message that indicates how many variables will be saved. Once the data are written, XSAVE indicates how many cases were saved. If the second message does not appear, the file was probably not completely written.

Limitations

  • Maximum of 64 XSAVE commands are allowed within a single set of transformations.