01-13-2015 10:56 AM
I am looking at a code and trying to understand how the macro gets triggered. Program A has a %include that references program B. Program B has 3 macros in it. Nowhere in Program A or Program B do I see those 3 macros being referenced with %macro_name.
Based on what I understand, a macro gets executed when you use %macro_name to trigger it. I don't see the 3 macro names referenced in any program. How does the code trigger the 3 macros in this case? Please let me know if I am not clear.
01-13-2015 11:06 AM
They don't. You can create the template for the macro code as much as you like:
%macro XYZ ();
But if nowhere in the code does: %XYZ (); appear then that macro does not get executed. There is not trigger to insert the macro code anywhere.
01-13-2015 12:04 PM
Chances are, they are not executed. Perhaps the %INCLUDE statement was merely copied from another program that did actually use the macros. But other possibilities exist.
Another %INCLUDE statement might bring in code that executes %MACRO_NAME.
Another macro might execute, which executes %MACRO_NAME.
If it's a short-running program, you might just remove the %INCLUDE, run the program, and see what happens.
01-14-2015 01:32 AM
To check, add a statement to the macros in program B like %put 'Macro executed now';
Then look in the log for this message.
It may well be that the same macros or any statements that have the same effect are already executed in/from the autoexec.sas
Also consider using options mlogic to see when a macro is being executed and what it does.