1
votes

I do have the following setup:

A process engine calls via rest a stored process (STP) in SAS. This stored process then calls another macro, which will take approx. one hour to be finished. The macro is supposed to be run in background, hence the STP can just stream back macro has been started successfully. Once the long macro has been finished it uses an proc http to tell the process engine that it has been finished.

My problem is, that when I'm trying to run the macro using rsubmit, the STP waits for the macro to be finished before it finishes running itself.

I'm using the following simplified code to solve my problem: STP:

%macro my_stp;
    
  %let rhost=&syshostname. 7551;  
  signon rhost user='***' password='***';
     rsubmit remote=rhost connectwait=no;
       %include "<path to mymacro>"; 
       %mymacro;
     endrsubmit;
  signoff rhost;  
 
%mend;

%my_stp;

Macro code:

%macro mymacro;
  %put Hello World;
  data _null_;
    call sleep(10,1);
  run;
%mend;

How can I make sure the STP does not wait for the macro to be finished? Thank you for your help!

1

1 Answers

1
votes

Add the _action=background parameter to your STP. For example, if you were submitting it through a URL:

https://mysashost.com/SASStoredProcess/do?_program=/MySTPDir/MySTP&_action=background

If you do not want the entire STP to run in the background, you will need to create a separate STP for the rsubmit block, call it through proc http, and add the action=_background parameter to it.

%macro my_stp;
    
  proc http url='https://mysashost.com/SASStoredProcess/do_program=/MySTPDir/MyRsubmitProgram&_action=background';
  run;

  <other code>;

%mend;