Storing and calling macros
There are two ways to store and call macros in SAS. Either the macro can be placed within the same code as where it is called, as we have demonstrated, or it can be placed in a separate file. This section will provide guidance about the choice of whether to store the macro in the same code as where it is called, or in a different set of code.
Storing and calling macros in the same code
So far in this chapter, we have been storing and calling macros from the same code:
First, we program the macro, then run it. This places the macro in SAS memory.
Then, we call the macro in the same code by its name, making SAS pull it from memory.
We also add values to macro variables when we call the macro, and that allows the macro processor to fill in the values, rewrite the SAS code for us, and execute it.
While this is a fine way to do it for demonstration purposes, in reality, if we were automating ETL, we would want to store the macros in...