Debugging a macro is not fun, but here are some steps that can help: 1. Turn on Options SYMBOLGEN MPRINT; This will allow you to see what's going on in your code. 2. Add selective %PUT/PUT statements as required to see variables values throughout the process. 3. Move the %mend up to your first "point" in the macro where you can safely run it and test it in iterations. Get one step working and then work on the next step. Additionally, when first writing a macro it helps to first have working code that is non-macrotized and start from there. Always test changes in as small a batch as you can.
... View more