Overview (SAVE CODEPAGE command)

In Unicode mode, SAVE CODEPAGE produces a data file in the specified locale character encoding.

Options

Encoding. You can use the ENCODING subcommand to specify the character encoding.

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 can use the UNSELECTED subcommand to specify inclusion or exclusion of filtered cases. By default, all cases are included.

Encryption. You can use the PASSPROTECT subcommand to save the file as encrypted, allowing you to protect confidential information stored in the file.

Basic specification

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

Syntax rules

  • OUTFILE is required. All other subcommands are optional.
  • KEEP and DROP can each be used as many times as needed.
  • ENCODING, UNSELECTED, and PASSPROTECT can each be used only once.

Operations

  • SAVE CODEPAGE 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.
  • New variables that were created by transformations and procedures that occurred prior to the SAVE CODEPAGE 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 CODEPAGE command are included in the file; scratch variables are not included.
  • The active dataset is not changed by SAVE CODEPAGE. The file encoding specified on SAVE CODEPAGE does not affect the active dataset. SAVE CODEPAGE operates in a manner similar to commands that create data files in external formats, such as WRITE and SAVE TRANSLATE.

Limitations

  • SAVE CODEPAGE is only available in Unicode mode. An error occurs if you use this command in code page mode. For more information on Unicode and code page mode, see the SET command, UNICODE subcommand.