Chapter Contents |
Previous |
Next |
SAS Macro Language: Reference |
A macro language statement instructs the macro processor to perform an operation. It consists of a string of keywords, SAS names, and special characters and operators, and it ends in a semicolon. Some macro language statements are allowed only in macro definitions, but you can use others anywhere in a SAS session or job, either inside or outside macro definitions (referred to as open code). Macro Language Statements Allowed in Macro Definitions and Open Code lists macro language statements that you can use in both macro definitions and open code.
Statement | Description |
---|---|
%* comment | designates comment text |
%DISPLAY | displays a macro window |
%GLOBAL | creates macaro variables that are available during the execution of an entire SAS session |
%INPUT | supplies values to macro variables during macro execution |
%KEYDEF | assigns a definition to or identifes the definition of a function key |
%LET | creates a macro variable and assigns it a value |
%MACRO | begins a macro definition |
%PUT | writes text or the values of macro variables to the SAS log |
%SYSCALL | invokes a SAS call routine |
%SYSEXEC | issues operating system commands |
%SYSLPUT | defines a new macro variable or modifies the value of an existing macro variable on a remote host or server |
%SYSRPUT | assigns the value of a macro variable on a remote host to a macro variable on the local host |
%WINDOW | defines customized windows |
Macro Language Statements Allowed in Macro Definitions Only lists macro language statements that you can use only in macro definitions.
Statement | Description |
---|---|
%DO | begins a %DO group |
%DO, Iterative | executes statements repetitively, based on the value of an index variable |
%DO %UNTIL | executes statements repetively unti la condition is true |
%DO %WHILE | executes statements repetitively while a condition is true |
%END | ends a %DO group |
%GOTO | branches macro processing to the specified label |
%IF-%THEN/%ELSE | conditionally processes a portion of a macro |
%label: | identifies the destination of a %GOTO statement |
%LOCAL | creates macro variable that are available only during the execution of the macro where they are defined |
%MEND | ends a macaro definition |
Some macro statements perform an operation based on an evaluation of an arithmetic or logical expression. They perform the evaluation by automatically calling the %EVAL function. If you get an error message about a problem with %EVAL when a macro does not use %EVAL explicitly, check for one of these statements. The macro statements that perform automatic evaluation are:
| ||
| ||
| ||
|
For details on operands and operators in expressions, see Chapter 6, "Macro Expressions."
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.