BookmarkSubscribeRSS Feed
jmq124
Calcite | Level 5
I'm having a strange problem running my macro. When I call the macro using the %include statement, SAS is unable to read any subsequent code in the main coding. It's like it can't tell the difference between the end of the macro and the start of the next section of code. However, when I paste the macro directly into my main code file, everything runs perfectly. I have checked and double-checked, and my addresses are correct and the macro code is identical. What could be the source of this inconsistency?
3 REPLIES 3
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
The possibilities of your problem root-cause are numerous - your best approach to get some feedback is to post your code, preferably from the SAS log execution. Do pay attention to this useful forum post though when you COPY/PASTE your own code into your reply:

http://support.sas.com/forums/thread.jspa?messageID=27609毙

Of course, you should be including the OPTIONS statement below with your own desk-checking to rule-out coding syntax and logic possibilities contributing to your problem symptom:

OPTIONS SOURCE SOURCE2 MACROGEN SYMBOLGEN MLOGIC MPRINT;

Scott Barry
SBBWorks, Inc.
SUN59338
Obsidian | Level 7
if you forget to run the macro, but just inlcude it? or by document, you don't have to add a semicolon at the end when you call a macro, but I always add one if the macro is not only a part of open code statement.

%include "macroname";

open code;
...
%macroname;
...

unless:

if variable le %macroname then do;
end;
PatrickG
SAS Employee
I haven't been to the forum lately. Is this still an issue for you?

When you say "call the macro with %include" it's not clear if you mean that you're including the macro definition up front, then trying to execute it later in the program; or if you actually have the call to the macro in the code you're including.

Scott is right. If we can see your code we can probably help with this. If you aren't comfortable posting it here to a public forum, call SAS Technical Support and have them take a look.

--Pat

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 1313 views
  • 0 likes
  • 4 in conversation