BookmarkSubscribeRSS Feed
tbellmer
Fluorite | Level 6

I am writing a fairly complex report that uses ODS REGIONs and is encapsulated inside a macro.  One of the things I do is call another macro to handle the custom footnote area (I am not using a traditional footnote).

Both the main report macro and the footnote macro are ONLY used for this report task.

So should the footnote macro be INSIDE the MAIN macro or outside of it in the same SAS program file or does it really matter?  Guess I am looking for a best practice as I doubt it matters...

3 REPLIES 3
PaigeMiller
Diamond | Level 26

Best practice ... do not nest macros

--
Paige Miller
Astounding
PROC Star

Agreed, except in the rarest of circumstances.  Consider nesting definitions only when:

(1) The macros are always married and never useful as separate macros, and

(2) The outer macro is used only once per program

Consider that the inner macro could at some point have expanded functionality that might make it useful for other applications.

Also consider that when you nest macros, each time you execute the outer macro it redefines the inner macro.  That represents extra work (even if it might be a small amount of extra work).

data_null__
Jade | Level 19

Or if the OUTER writes the INNER using the parameters or data passed to OUTER.

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
  • 3128 views
  • 1 like
  • 4 in conversation