Macro Statements
Using Macro Statements
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 used only in macro
definitions. You can use others anywhere in a SAS session or job, either inside or outside
macro definitions (referred to as open code). The following table lists macro language
statements that you can use in both macro definitions and open code.
Table 12.1 Macro Language Statements Used in Macro Definitions and Open Code
Statement Description
%* comment Designates comment text.
%COPY Copies specified items from a SAS library.
%DISPLAY Displays a macro window.
%GLOBAL Creates macro variables that are available during the execution of
an entire SAS session.
%IF %THEN %ELSE Conditionally processes a portion of a macro.
%INPUT Supplies values to macro variables during macro execution.
%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.
%SYMDEL Deletes the indicated macro variable named in the argument.
%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.
%SYSMACDELETE Deletes a macro definition from the Work.SASMacr catalog.
%SYSMSTORECLEAR Closes stored compiled macros and clears the SASMSTORE=
library.
158 Chapter 12 • Macro Language Elements