I'm also surprised that a * comment in a macro definition can comment out a macro invocation:
options mlogic ;
%macro abc();
%put I do not execute ;
%mend;
%macro doit() ;
* %abc() ;
%mend;
%doit()
I think you're right that officially a macro invocation is not a macro language statement. So perhaps this behavior is undefined by the documentation.
But I don't think the macro call should go to the word queue. I would expect when the above macro executes the * would go to the word queue, the macro call %abc would execute, and then the semicolon would go to the word queue. But obviously that's not what happens.
My guess is it has something to do with the macro language compiler. Clearly when the macro is compiled, the compiler is looking inside of * comments. This is because the * has no meaning to the macro compiler. And it is why macro statements inside of a * comment will be compiled (and later executed). I suppose it's possible that a macro invocation is not compiled in the same way as a macro statement is compiled.
Okay, here's another oddity. With this code:
options mlogic ;
%macro abc();
Hello world
%mend;
%macro doit() ;
* %abc() ;
%mend;
If I code:
%doit()
the macro ABC is not invoked. But if I code:
%put %doit() ;
the macro ABC is invoked.
So I'm not sure what to conclude, except that the * is not a comment in the macro language, and when you use * comments inside a macro definition, behavior can be odd.
I'm away from my bookcase. Does Art not explain this behavior?
... View more