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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

DEFINE—!ENDDEFINE 447<br />

• This example is the same as the previous one, except that it assigns three tokens to one<br />

argument instead of assigning one token to each of three arguments. The result is the<br />

same.<br />

Example<br />

DEFINE macdef (!POS !TOKENS(1)<br />

/!POS !TOKENS(1)<br />

/!POS !TOKENS(1)<br />

frequencies variables = !*.<br />

!ENDDEFINE.<br />

macdef V1 V2 V3.<br />

• This is a third alternative for achieving the macro expansion shown in the previous two<br />

examples. It specifies three arguments but then joins them all together on one FREQUEN-<br />

CIES command using the symbol !*.<br />

Assigning Tokens to Arguments<br />

A token is a character or group of characters that has a predefined function in a specified<br />

context. The argument definition must include a keyword that indicates which tokens<br />

following the macro name are associated with each argument.<br />

• Any program keyword, variable name, or delimiter (a slash, comma, etc.) is a valid token.<br />

• The arguments for a given macro can use a combination of the token keywords.<br />

!TOKENS (n) Assign the next n tokens to the argument. The value n can be any positive<br />

integer and must be enclosed in parentheses. !TOKENS allows you<br />

to specify exactly how many tokens are desired.<br />

!CHAREND (’char’) Assign all tokens up to the specified character to the argument. The<br />

character must be a one-character string specified in apostrophes and<br />

enclosed in parentheses. !CHAREND specifies the character that ends<br />

the argument assignment. This is useful when the number of assigned<br />

tokens is arbitrary or not known in advance.<br />

!ENCLOSE (’char’,’char’) Assign all tokens between the indicated characters to the argument.<br />

The starting and ending characters can be any one-character strings,<br />

and they do not need to be the same. The characters are each enclosed<br />

in apostrophes and separated by a comma. The entire specification is<br />

enclosed in parentheses. !ENCLOSE allows you to group multiple tokens<br />

within a specified pair of symbols. This is useful when the number<br />

of tokens to be assigned to an argument is indeterminate, or when<br />

the use of an ending character is not sufficient.<br />

!CMDEND Assign to the argument all of the remaining text on the macro call, up<br />

to the start of the next command. !CMDEND is useful for changing the<br />

defaults on an existing command. Since !CMDEND reads up to the next<br />

command, only the last argument on the argument list can be specified<br />

with !CMDEND. If !CMDEND is not the final argument, the arguments<br />

following !CMDEND are read as text.

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

Saved successfully!

Ooh no, something went wrong!