'Run local macro in RSUBMIT SAS/CONNECT

This is a similar question as in here, but using OPTIONS MSTORED SASMSTORE instead. The issue is having functions stored in a library utils, and calling them inside a RSUBMIT statement. A minimum code would be like:

LIBNAME utils 'path/to/utils';
OPTIONS MSTORED SASMSTORE=utils;

%MACRO foo() / STORE;
*sas code;
%MEND foo;

%MACRO run_foo_parallel() / STORE;
options sascmd="sas"
SIGNON task;
RSUBMIT task;
%foo();
ENDRSUBMIT;
WAITFOR _all_;
SIGNOFF _all_;
%MEND;

In my real problem, I am parallelizing and running foo() in several datasets at a time. I don't know how to tell SAS to identify %foo(); in the correct utils folder. Things I've considered:

  • %SYSLPUT but this is only for macro variables
  • Use RSUBMIT task inheritlib(utils); and add OPTIONS MSTORED SASMSTORE=utils; inside the RSUBMIT. But then it raises an error A lock is not available for UTILS.SASMCR.CATALOG

Any help would be valuable! The "easy trick" is to write foo() inside the RSUBMIT without the STORE option, but it does not seem best practice.

Thank you all



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source