Chapter 10
Macro Facility Error Messages
and Debugging
General Macro Debugging Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
Developing Macros in a Layered Approach . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
Encountering Errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
Developing Bug-free Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
Troubleshooting Your Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
Solving Common Macro Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
Solving Macro Variable Resolution Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
Solving Problems with Macro Variable Scope . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
Solving Open Code Statement Recursion Problems . . . . . . . . . . . . . . . . . . . . . . . 127
Solving Problems with Macro Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128
Solving Unresolved Macro Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128
Solving the “Black Hole” Macro Problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128
Resolving Timing Issues . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
Example of a Macro Statement Executing Immediately . . . . . . . . . . . . . . . . . . . . 130
Resolving Macro Resolution Problems Occurring during
DATA Step Compilation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
Solving Problems with the Autocall Facility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
Fixing Autocall Library Specifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
Fixing Autocall Macro Definition Errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
File and Macro Names for Autocall . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134
Displaying Information about Stored Compiled Macros . . . . . . . . . . . . . . . . . . . . 134
Solving Problems with Expression Evaluation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
Debugging Techniques . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136
Using System Options to Track Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136
Tracing the Flow of Execution with MLOGIC . . . . . . . . . . . . . . . . . . . . . . . . . . . 136
Nesting Information Generated by MLOGICNEST . . . . . . . . . . . . . . . . . . . . . . . . 137
Examining the Generated SAS Statements with MPRINT . . . . . . . . . . . . . . . . . . 137
Nesting Information Generated by MPRINTNEST . . . . . . . . . . . . . . . . . . . . . . . . 138
Storing MPRINT Output in an External File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138
Examining Macro Variable Resolution with SYMBOLGEN . . . . . . . . . . . . . . . . . 139
Using the %PUT Statement to Track Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . 140
121
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset