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.

Example<br />

Example<br />

* Macro without arguments: Specify a group of variables.<br />

DEFINE sesvars ()<br />

age sex educ religion.<br />

!ENDDEFINE.<br />

DEFINE—!ENDDEFINE 443<br />

FREQUENCIES VARIABLES=sesvars.<br />

• The macro name is sesvars. Because the parentheses are empty, sesvars has no arguments.<br />

The macro body defines four variables: AGE, SEX, EDUC, and RELIGION.<br />

• The macro call is specified on FREQUENCIES. When the call is executed, sesvars is<br />

expanded into the variables AGE, SEX, EDUC, and RELIGION.<br />

• After the macro expansion, FREQUENCIES is executed.<br />

* Macro without arguments: Repeat a sequence of commands.<br />

DATA LIST FILE = MAC4D /GROUP 1 REACTIME 3-5 ACCURACY 7-9.<br />

VALUE LABELS GROUP 1’normal’<br />

2’learning disabled’.<br />

* Macro definition.<br />

DEFINE check ()<br />

split file by group.<br />

frequencies variables = reactime accuracy<br />

/histogram.<br />

descriptives reactime accuracy.<br />

list.<br />

split file off.<br />

regression variables = group reactime accuracy<br />

/dependent = accuracy<br />

/enter<br />

/scatterplot (reactime, accuracy).<br />

!ENDDEFINE.<br />

check. /* First call of defined macro check<br />

COMPUTE REACTIME = SQRT (REACTIME).<br />

COMPUTE ACCURACY = SQRT (ACCURACY).<br />

check. /* Second call of defined macro check<br />

COMPUTE REACTIME = lg10 (REACTIME * REACTIME).<br />

COMPUTE ACCURACY = lg10 (ACCURACY * ACCURACY).<br />

check. /* Third call of defined macro check<br />

• The name of the macro is CHECK. The empty parentheses indicate that there are no arguments<br />

to the macro.<br />

• The macro definition (between DEFINE and !ENDDEFINE) contains the command<br />

sequence to be repeated: SPLIT FILE, FREQUENCIES, DESCRIPTIVES, LIST, SPLIT FILE,<br />

and REGRESSION.

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

Saved successfully!

Ooh no, something went wrong!