Debugging SAS macros
As has been said before, it is very difficult to edit and debug SAS macros. One way to make this work easier is to use a step-by-step design process to develop macros. That way, at each point in the step, if something goes wrong, it is easier to troubleshoot. This can also be helped by the %PUT
command. These approaches will be described here.
Avoiding errors through the design process
Let's revisit Chapter 8, Using Macros to Automate ETL in SAS, for a moment, where we developed a macro called %make_flag
that created a series of two-state flag variables based on a series of grouping variables that were all coded similarly. In Chapter 8, Using Macros to Automate ETL in SAS, we mentioned that we should use a step-by-step process for designing a macro that starts with creating a working data step with one of the variables and then converting parts of this data step to macro variables. We said we would show the details of that process here.
Let's...