27.03.2013 Views

SPSS® 12.0 Command Syntax Reference

SPSS® 12.0 Command Syntax Reference

SPSS® 12.0 Command Syntax Reference

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

454 DEFINE—!ENDDEFINE<br />

MITERATE Maximum loop iterations permitted in macro expansions. The default number<br />

of iterations is 1000.<br />

Restoring SET Specifications<br />

The PRESERVE and RESTORE commands bring more flexibility and control over SET.<br />

PRESERVE and RESTORE are available generally within the program but are especially<br />

useful with macros.<br />

• The settings of all SET subcommands—those set explicitly and those set by default (except<br />

MEXPAND)—are saved with PRESERVE. PRESERVE has no further specifications.<br />

• With RESTORE, all SET subcommands are changed to what they were when the PRESERVE<br />

command was executed. RESTORE has no further specifications.<br />

• PRESERVE...RESTORE sequences can be nested up to five levels.<br />

PRESERVE Store the SET specifications that are in effect at this point in the session.<br />

RESTORE Restore the SET specifications to what they were when PRESERVE was<br />

specified.<br />

Example<br />

* Two nested levels of preserve and restore’.<br />

DEFINE macdef ()<br />

preserve.<br />

set format F5.3.<br />

descriptives v1 v2.<br />

+ preserve.<br />

set format F3.0 blanks=999.<br />

descriptives v3 v4.<br />

+ restore.<br />

descriptives v5 v6.<br />

restore.<br />

!ENDDEFINE.<br />

• The first PRESERVE command saves all of the current SET conditions. If none have been<br />

specified, the default settings are saved.<br />

• Next, the format is set to F5.3 and descriptive statistics for V1 and V2 are obtained.<br />

• The second PRESERVE command saves the F5.3 format setting and all other settings in<br />

effect.<br />

• The second SET command changes the format to F3.0 and sets BLANKS to 999 (the default<br />

is SYSMIS). Descriptive statistics are then obtained for V3 and V4.<br />

• The first RESTORE command restores the format to F5.3 and BLANKS to the default, the<br />

setting in effect at the second PRESERVE. Descriptive statistics are then obtained for V5<br />

and V6.<br />

• The last RESTORE restores the settings in effect when the first PRESERVE was specified.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!