sasauto option and SAS macro

Accepted Solution Solved
Reply
Contributor
Posts: 29
Accepted Solution

sasauto option and SAS macro

 

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;

 


Accepted Solutions
Solution
‎10-02-2017 04:16 PM
Super User
Posts: 11,552

Re: sasauto option and SAS macro

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


All Replies
Super User
Posts: 5,605

Re: sasauto option and SAS macro

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.

Solution
‎10-02-2017 04:16 PM
Super User
Posts: 11,552

Re: sasauto option and SAS macro

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

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 94 views
  • 0 likes
  • 3 in conversation