is the portion of SAS that does the work
is the syntax that you use to communicate with the macro processor
When SAS compiles program text, two delimiters trigger macro processor activity:
refers to a macro variable. “Replacing Text Strings Using Macro Variables” on page
8 explains how to create a macro variable. The form &name is called a macro
refers to a macro. “Generating SAS Code Using Macros” on page 9 explains how
to create a macro. The form %name is called a macro call.
The text substitution produced by the macro processor is completed before the program
text is compiled and executed. The macro facility uses statements and functions that
resemble the statements and functions that you use in the DATA step. An important
difference, however, is that macro language elements can enable only text substitution
and are not present during program or command execution.
Note: Three SAS statements begin with a % that are not part of the macro facility.
These elements are the %INCLUDE, %LIST, and %RUN statements in SAS DATA
Step Statements: Reference.
The following graphic explains the syntax used in this document:
Using the Macro Facility in SAS Viya
The macro facility does not run within Cloud Analytic Services (CAS). The macro
facility runs in a SAS client session within SAS Viya. You can use the macro facility to
generate code for procedures, DATA steps, and global statements. Code generated by the
macro facility can use LIBNAME engines. CAS uses caslibs and data connectors instead
of LIBNAME statements.
All macros are created in and executed from a SAS client session. In this example the
macro myMac1 contains a DATA step to add the X variable to the Work.Class data set.
The DATA step created by myMac1 macro uses the V9 engine to read the V9 data set
Class from the SASHELP library and outputs a V9 data set in the Work directory.
4 Chapter 1 • Introduction to the Macro Facility