BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
park2039
Calcite | Level 5

 

I ran the following program using the SAS EG.  I defined a macro run_macro in the main program.  I created a separate program macro_1.sas in /foldername/ folder which contains a macro macro_1.  After I make changes in macro_1.sas and run the main program, why is the SAS keep running the same codes before the changes? It runs the program correctly only if I close the SAS, re-open and run. Does someone know why?   

 

options pagesize=59  mautosource  sasautos="/foldername/";

%macro run_macro;

%* ;

  %macro_1;

%* ;

%mend run_macro;

%run_macro;

 

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

You may also need to set the option MREPLACE to enable a previously defined macro to be replaced with the newer version.

View solution in original post

2 REPLIES 2
Astounding
PROC Star

You are observing standard behavior.  SAS does not look for the macro definition each time you use the macro.  It only searches for the macro definition if the macro is not yet defined.  So you have changed the definition, but SAS doesn't look for the new definition.

 

For a contining EG session, try adding a %INCLUDE statement to bring in the file holding the revised macro definition.  %INCLUDE can be placed either inside or outside a macro definition, wherever you see fit to redefine a macro.

ballardw
Super User

You may also need to set the option MREPLACE to enable a previously defined macro to be replaced with the newer version.

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!

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
  • 2 replies
  • 542 views
  • 0 likes
  • 3 in conversation