### 9.6 SAVE

         SAVE
                 /OUTFILE={'file_name',file_handle}
                 /UNSELECTED={RETAIN,DELETE}
                 /{COMPRESSED,UNCOMPRESSED}
                 /PERMISSIONS={WRITEABLE,READONLY}
                 /DROP=var_list
                 /KEEP=var_list
                 /VERSION=version
                 /RENAME=(src_names=target_names)...
                 /NAMES
                 /MAP

The `SAVE` procedure causes the dictionary and data in the active dataset to be written to a system file.

OUTFILE is the only required subcommand. Specify the system file to be written as a string file name or a file handle (see File Handles).

By default, cases excluded with FILTER are written to the system file. These can be excluded by specifying `DELETE` on the `UNSELECTED` subcommand. Specifying `RETAIN` makes the default explicit.

The `COMPRESS` and `UNCOMPRESS` subcommand determine whether the saved system file is compressed. By default, system files are compressed. This default can be changed with the SET command (see SET).

The `PERMISSIONS` subcommand specifies permissions for the new system file. WRITEABLE, the default, creates the file with read and write permission. READONLY creates the file for read-only access.

By default, all the variables in the active dataset dictionary are written to the system file. The `DROP` subcommand can be used to specify a list of variables not to be written. In contrast, KEEP specifies variables to be written, with all variables not specified not written.

Normally variables are saved to a system file under the same names they have in the active dataset. Use the `RENAME` subcommand to change these names. Specify, within parentheses, a list of variable names followed by an equals sign (‘`=`’) and the names that they should be renamed to. Multiple parenthesized groups of variable names can be included on a single `RENAME` subcommand. Variables' names may be swapped using a `RENAME` subcommand of the form `/RENAME=(`A B`=`B A`)`.

Alternate syntax for the `RENAME` subcommand allows the parentheses to be eliminated. When this is done, only a single variable may be renamed at once. For instance, `/RENAME=`A`=`B. This alternate syntax is deprecated.

`DROP`, `KEEP`, and `RENAME` are performed in left-to-right order. They each may be present any number of times. `SAVE` never modifies the active dataset. `DROP`, `KEEP`, and `RENAME` only affect the system file written to disk.

The `VERSION` subcommand specifies the version of the file format. Valid versions are 2 and 3. The default version is 3. In version 2 system files, variable names longer than 8 bytes will be truncated. The two versions are otherwise identical.

The `NAMES` and `MAP` subcommands are currently ignored.

`SAVE` causes the data to be read. It is a procedure.