Creating macros out of data step code
When automating ETL, we would like to use macros in data step code. However, to understand how to do this, it is important to learn about other topics first. This section will start by explaining the difference between macros and macro variables, and describing how to set macro variables with the %LET
command. Next, we will move on to writing code, then rebuilding it into macros. First, we will do that with PROCs, and then we will do it with data steps. Finally, this section will demonstrate how to add conditions to macros to further enhance automated processing.
Choosing to use macros and macro variables
SAS is said by some to not be one language, but a collection of languages. Those who say that point to the fact that data step language is different than PROC syntax, and that PROC SQL
is a different set of commands altogether. Another language in SAS is called the macro language.
In their SAS white paper, SAS Macro Programming for Beginners...