BookmarkSubscribeRSS Feed
Rhys
Obsidian | Level 7

Hello, I've created a macro that I can store globally on a linux server defined as follows;

 

 

options mstored sasmstore = macrolib;
libname macrolib '/sas_data/macrolib';

%macro test() / store;
  macro code...
%mend;

 

I can then call the macro in another EG session to execute the macro. 

 

%test();

Running...

 

Then if I open a further session I get

 

%test();

ERROR: A lock is not available for MACROLIB.SASMACR.CATALOG.

ERROR: Lock held by process 23669.

 

Is there a way to release the lock after the macro has been called but before if finishes executing?

3 REPLIES 3
ChrisNZ
Tourmaline | Level 20

 

You might want to contact tech support.

It works fine for me.

What I tested:

 

1st EG session, run this and disconnect server:

 

options mstored sasmstore = MACROLIB;
libname MACROLIB 'c:\temp';

%macro test() / store;  
  data _null_; call sleep(5,1); run;
  %put --------done------------;
%mend;

 

 

2 other EG sessions, run this concurrently:

 

options mstored sasmstore = MACROLIB;
libname MACROLIB 'c:\temp';
%test;

 

 

 

 

 

 

 

 

Tom
Super User Tom
Super User

You shouldn't need a lock to use the macro.  Are you trying to write new macros to the catalog from two different machines at the same time? Why?

Also why are you using macro catalogs instead of just using autocall macros?

Rhys
Obsidian | Level 7

I'm attempting to utilise parallel processing in EG; it would seem whenever a new process is created, effectively a new session is created with a new work. So any macros defined earlier in the project will not be auto called. 

 

In my project flow I have program that defines a macro then forks out to several programs which call that macro. Later in the process I define another macro and then call it multiple times in the same way. 

 

My issue is that only the first call is working, all subsequent calls error due to lock. 

 

EDIT: If I run the programs individually, they all work fine, running simulataneously, however when I highlight a few at a time and run together or run from branch then the lock errors occur. 

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 1145 views
  • 0 likes
  • 3 in conversation