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.

448 DEFINE—!ENDDEFINE<br />

Example<br />

* Keyword !TOKENS.<br />

DEFINE macname (!POSITIONAL !TOKENS (3)<br />

frequencies variables = !1.<br />

!ENDDEFINE.<br />

macname ABC DEFG HI.<br />

• The three tokens following macname (ABC, DEFG, and HI) are assigned to the positional<br />

argument !1, and FREQUENCIES is then executed.<br />

Example<br />

* Keyword !TOKENS.<br />

* Macro definition.<br />

DEFINE earnrep (varrep = !TOKENS (1))<br />

sort cases by !varrep.<br />

report variables = earnings<br />

/break = !varrep<br />

/summary = mean.<br />

!ENDDEFINE.<br />

* Call the macro three times.<br />

earnrep varrep= SALESMAN. /*First macro call<br />

earnrep varrep = REGION. /*Second macro call<br />

earnrep varrep = MONTH. /*Third macro call<br />

• This macro runs a REPORT command three times, each time with a different break variable.<br />

• The macro name is earnrep, and there is one keyword argument, varrep, which has one<br />

token.<br />

• In the first macro call, the token SALESMAN is substituted for !varrep when the macro is<br />

expanded. REGION and MONTH are substituted for !varrep when the macro is expanded in<br />

the second and third calls.<br />

Example<br />

* Keyword !CHAREND’.<br />

DEFINE macname (!POSITIONAL !CHAREND (’/’)<br />

/!POSITIONAL !TOKENS(2))<br />

frequencies variables = !1.<br />

correlations variables= !2.<br />

!ENDDEFINE.<br />

macname A B C D / E F.<br />

• When the macro is called, all tokens up to the slash (A, B, C, and D) are assigned to the<br />

positional argument !1. E and F are assigned to the positional argument !2.

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

Saved successfully!

Ooh no, something went wrong!