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

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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