Basic Concepts

Defining a Macro

In order to create a macro program, you must first define it. You begin a macro definition with a %MACRO statement, and you end the definition with a %MEND statement.
General form, %MACRO statement, and %MEND statement:
%MACRO macro-name;
text
%MEND <macro-name>;
Here is an explanation of the syntax:
macro-name
names the macro. The value of macro-name can be any valid SAS name that is not a reserved word in the SAS macro facility.
text
can be
  • constant text, possibly including SAS data set names, SAS variable names, or SAS statements
  • macro variables, macro functions, or macro program statements
  • any combination of the above.
Tip
You might want to include macro-name in the ...

Get SAS Certification Prep Guide, 4th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.