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
Thanks
R
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: http://documentation.sas.com/?docsetId=allprodslang&docsetTarget=syntaxByCategory-macroSystemOptions...
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.
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.
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?
You could turn your macro into an AUTOCALL one so it is available to all SAS sessions and can be called by any.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
Check out this tutorial series to learn how to build your own steps in SAS Studio.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.