This week's SAS author's tip comes from Carol Matthews and Brian Shilling and their book Validating Clinical Trial Data Reporting with SAS. SAS users have raved about this guide. In her review, Susan Fehrer said "Carol and Brian's book provides a good overview, practical hands-on tips, and many examples of how to perform a thorough validation. The authors' written style allows the reader to almost see and hear Carol and Brian sitting nearby in conversation. . . . The SAS programming examples in the book are very clear and easy to follow. This is a good reference book for all statistical and clinical SAS programmers."
If you like this week's tip, you can read a free chapter from the book here.
The following excerpt is from SAS Press authors Carol Matthews and Brian Shilling and their book "Validating Clinical Trial Data Reporting with SAS" Copyright © 2008, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED. (please note that results may vary depending on your version of SAS software)
4.2.3.3 Using MLOGIC
Another SAS option that is very useful for validating and debugging complex macro code is MLOGIC. Again, this option produces many extra lines in the log so it is often only turned on during the validation process and turned off during production. It is also most useful when working with complex macro logic that directly affects what code is submitted to the SAS compiler (and hence MPRINT does not show evidence of the macro compilation). When you are using the same code as Example 4.14, the MLOGIC option shows the following in the log:
Notice how the bold row differs from the note produced by the SYMBOLGEN option. In this case, not only does MLOGIC list the value to which macro variable &VALID resolves, but it also reports how the macro compiler resolved the logical IF statement (in this case, FALSE). While this is a very simple example, it is easy to imagine how this option could facilitate the validation and debugging of macro code with more complex logic.