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.

442 DEFINE—!ENDDEFINE<br />

• Immediately after DEFINE, specify the macro name. All macros must have a name. The<br />

name is used in the macro call to refer to the macro. Macro names can begin with an<br />

exclamation point (!), but other than this, follow the usual naming conventions. Starting<br />

a name with an ! ensures that it will not conflict with the other text or variables in the<br />

session.<br />

• Immediately after the macro name, specify an optional argument definition in parentheses.<br />

This specification indicates the arguments that will be read when the macro is<br />

called. If you do not want to include arguments, specify just the parentheses; the parentheses<br />

are required, whether or not they enclose an argument.<br />

• Next specify the body of the macro. The macro body can include commands, parts of<br />

commands, or macro statements (macro directives, string manipulation statements, and<br />

looping and conditional processing statements).<br />

• At the end of the macro body, specify the !ENDDEFINE command.<br />

To invoke the macro, issue a macro call in the command sequence. To call a macro, specify<br />

the macro name and any necessary arguments. If there are no arguments, only the macro<br />

name is required.<br />

Operations<br />

• When macros are used in a prompted session, the command line prompt changes to<br />

DEFINE> between the DEFINE and !ENDDEFINE commands.<br />

• When the program reads the macro definition, it translates into upper case all text (except<br />

arguments) not enclosed in quotation marks. Arguments are read in upper and lower case.<br />

• The macro facility does not build and execute commands; rather, it expands strings in a<br />

process called macro expansion. A macro call initiates macro expansion. After the<br />

strings are expanded, the commands (or parts of commands) that contain the expanded<br />

strings are executed as part of the command sequence.<br />

• Any elements on the macro call that are not used in the macro expansion are read and<br />

combined with the expanded strings.<br />

• The expanded strings and the remaining elements from the macro call, if any, must<br />

conform to the syntax rules for the program. If not, the program generates either a<br />

warning or an error message, depending on the nature of the syntax problem.<br />

Limitations<br />

• The BEGIN DATA—END DATA commands are not allowed within a macro.<br />

• The DEFINE command is not allowed within a macro.

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

Saved successfully!

Ooh no, something went wrong!