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