BookmarkSubscribeRSS Feed
Tomato42
Calcite | Level 5

 

Dear experts,

(sorry for bad english)

 

I have SAS 9.3 (sas base)

In some ETL process i have set of sequential macros.

I changed the code of one of them.

But in the sas log i see that old version (before my changes) of macro was executed. Macro was executed from memory.

 

NOTE: The macro MACRONAME is executing from memory.

What do I need to do to get the new version of the macro running?

Maybe object spawner can help me?

 

Thanks, 

Tmato

10 REPLIES 10
Kurt_Bremser
Super User

If your macros are initially read from an autocall directory, and you did not change the code there, then you'll run with the old version.

 

What happens if you specifically %include the file with your changed macro code? This should lead to a re-compile of the macro.

Tomato42
Calcite | Level 5

Hi, 

 

Thanks for your answer.

 

Big macro (call it macro1) that executes my macro (macro with memory-execution problem, call it macro2) is in the different directory(call it directory1) from directory of macro2(call it directory2).

 

So when i add to the code of macro1 this statement:

%include macro2 "directory2";

it gives me error

WARNING: Physical file does not exist, directory1\macro2
ERROR: Cannot open %INCLUDE file macro2

But when i copy macro2 to directory1 and add this code

%include macro2 "directory1";

Errors do not appear. And after i fully remove %include statement, the old version of the macro is called again.

I do not know why but it is.

What other versions can be here?

ballardw
Super User

You might want to check your system setting for the MCOMPILE option. if it is set to NOMCOMPILE the system may not allow redefining a macro. You  can check with

 

proc options option=mcompile;

run;

 

if you see NOMCOMPILE in the log result then use the options statement to set MCOMPILE.

Tomato42
Calcite | Level 5

Hi, ballardw

 

This statement returns

 

 SAS (r) Proprietary Software Release 9.3  TS1M0

 MCOMPILE          Allow compilation for macros that are not autocall macros
ballardw
Super User

@Tomato42 wrote:

Hi, ballardw

 

This statement returns

 

 SAS (r) Proprietary Software Release 9.3  TS1M0

 MCOMPILE          Allow compilation for macros that are not autocall macros

So that isn't the issue. It was a moderately long shot but some shops or borrowed code might set that and would cause the symptom you are explaining.

Kurt_Bremser
Super User

@Tomato42 wrote:

Hi, 

 

...........

And after i fully remove %include statement, the old version of the macro is called again.

I do not know why but it is.

What other versions can be here?


That points very strongly to an autocall macro with the old version, or an old version that is included through one of the SAS autoexec features.

How do you run your program?

(Enterprise Guide, SAS Studio, batch)

Tomato42
Calcite | Level 5

Hi, KurtBremser

I run my program from the batch-file

Kurt_Bremser
Super User

Then you should look at the autoexec.sas file for your batch runs, and the value of the SASAUTOS system option (command line, config file).

Tomato42
Calcite | Level 5

In the value of this parameter there is a directory containing a problematic macro. However, for other macros from the directories of this parameter, the changes remain and the modified version of the macros is executed.

Kurt_Bremser
Super User

How do you include the "modified version" of all your macros in your codes? You either get a macro from the autocall, or you include them from a file, or you have them explicitly written in your code.

So if you only get your macro through the autocall facility, you need to save the modified version THERE.

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
  • 10 replies
  • 1043 views
  • 1 like
  • 3 in conversation