Restoring SET Specifications (DEFINE-!ENDDEFINE command)
The PRESERVE
and RESTORE
commands bring
more flexibility and control over SET
. PRESERVE
and RESTORE
are available generally within the
program but are especially useful with macros.
- The settings of all
SET
subcommands—those set explicitly and those set by default (exceptMEXPAND
)—are saved withPRESERVE
.PRESERVE
has no further specifications. - With
RESTORE
, allSET
subcommands are changed to what they were when thePRESERVE
command was executed.RESTORE
has no further specifications. -
PRESERVE...RESTORE
sequences can be nested up to five levels.
PRESERVE. Store the SET specifications that are in effect at this point in the session.
RESTORE. Restore the SET specifications to what they were when PRESERVE was specified.
Example
* Two nested levels of preserve and restore'.
DEFINE macdef ()
preserve.
set format F5.3.
descriptives v1 v2.
+ preserve.
set format F3.0 blanks=999.
descriptives v3 v4.
+ restore.
descriptives v5 v6.
restore.
!ENDDEFINE.
- The first
PRESERVE
command saves all of the currentSET
conditions. If none have been specified, the default settings are saved. - Next, the format is set to
F5.3
and descriptive statistics for V1 and V2 are obtained. - The second
PRESERVE
command saves theF5.3
format setting and all other settings in effect. - The second
SET
command changes the format toF3.0
and setsBLANKS
to 999 (the default isSYSMIS
). Descriptive statistics are then obtained for V3 and V4. - The first
RESTORE
command restores the format toF5.3
andBLANKS
to the default, the setting in effect at the secondPRESERVE
. Descriptive statistics are then obtained for V5 and V6. - The last
RESTORE
restores the settings in effect when the firstPRESERVE
was specified.