DATA Step, Macro, Functions and more

Updating macros metadata

Reply
Occasional Contributor
Posts: 5

Updating macros metadata

 

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

Super User
Posts: 6,926

Re: Updating macros metadata

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.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Occasional Contributor
Posts: 5

Re: Updating macros metadata

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?

Super User
Posts: 10,454

Re: Updating macros metadata

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.

Occasional Contributor
Posts: 5

Re: Updating macros metadata

Hi, ballardw

 

This statement returns

 

 SAS (r) Proprietary Software Release 9.3  TS1M0

 MCOMPILE          Allow compilation for macros that are not autocall macros
Super User
Posts: 10,454

Re: Updating macros metadata


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.

Super User
Posts: 6,926

Re: Updating macros metadata


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)

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Occasional Contributor
Posts: 5

Re: Updating macros metadata

Hi, KurtBremser

I run my program from the batch-file

Super User
Posts: 6,926

Re: Updating macros metadata

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).

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Occasional Contributor
Posts: 5

Re: Updating macros metadata

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.

Super User
Posts: 6,926

Re: Updating macros metadata

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.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Ask a Question
Discussion stats
  • 10 replies
  • 166 views
  • 1 like
  • 3 in conversation