BookmarkSubscribeRSS Feed
Bensansing
Calcite | Level 5

Hey all,

I am trying to call a different include statement inside of a macro, but having the include different based on if a different macro is selected

ex:

%macro DDL;

%if &upd = 2 or &upd = 4 or &upd = 5 %then %do;

  %include "/test/&csv..sas";

%end;

%else %do;

  %include "/test/&fn..sas";

%end;

%mend DDL;

%DDL

Inside each of those is a different macro that needs to be used in a proc sql statement, but when I put this logic in my program is not reading the macor &Query

But when I had it just this it would work: %include "/test/&fn..sas";

Not sure it's including it from the macro.. any thoughts?

Thanks

1 REPLY 1
ballardw
Super User

Unless those include files have identically named macros (and nothing else) with different behavior I would suggest you are spending a lot of time for not much reward. And if you do have the same named macro in each that is generally not a good idea. If they do different things they should have a different name.

Since compiling macros takes relatively few processes, include all of the macro source code at the start of the job, or investigate AUTOCALL macro libraries.

Are you getting errors? What value(s) of UPD that is causing the problem?

Have you run this with OPTIONS MPRINT SOURCE2;

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 1 reply
  • 791 views
  • 0 likes
  • 2 in conversation