Desktop productivity for business analysts and programmers

Parallel Processing with Macros

Posts: 22

Parallel Processing with Macros

Hello, I'm trying to call a macro in EG with Parallel processing enabled. 


The macro is defined in one program that is then linked to multiple others which all call it. However it will only get called the first time and then is dropped from memory. 


If I remove the macro definition program and instead place a copy in the call scripts they all run in parallel. However I only want to define the macro once, so any changes aren't made multiple times. 



How do I define a macro across multiple parallel processes



Trusted Advisor
Posts: 1,852

Re: Parallel Processing with Macros

[ Edited ]

Hello @Rhys,


I am not the most expert here, so if I cannot help you, please wait a bit, there will be more colleagues willing to help you.


For me, as former java programmer, the answer would be simple, in a way. As you said, the problem is the multiple definition of the macro, but you can call it many times.


You can split your program on one, just to be executed once, where you can include the macro definition, and then the other, or other programs, to be executed recursively with parallel processing enabled, where you will be calling the macro as many times as needed.


Another option, mostly generalised, is to have a location only with macro code, and include its location on your sasv9_usermodes in the Workspace Server. See SASAUTOS option (between others) in here:


With this latest option, you won't need to define the macro again, every time you start an EG session, you will have the macro available for you.

Posts: 22

Re: Parallel Processing with Macros

Posted in reply to JuanS_OCS

Thanks for your reply. 


I was thinking of using %include however, the server is on Linux and the client is Windows so it's not easy to get a script into an area that is readable by the server.

Super User
Posts: 24,004

Re: Parallel Processing with Macros

I'm assuming you do have some library space on the server? If so, can you compile the macro once and store it in the library?

Super User
Posts: 4,023

Re: Parallel Processing with Macros

You could turn your macro into an AUTOCALL one so it is available to all SAS sessions and can be called by any. 

Ask a Question
Discussion stats
  • 4 replies
  • 4 in conversation