如何在 SAS 中将 rsubmit 用于 运行 后台进程而不等待它完成

How to use rsubmit in SAS for running a process in background without waiting it to be finished

我有以下设置:

流程引擎通过 rest 调用 SAS 中的存储流程 (STP)。 这个存储过程然后调用另一个宏,这将花费大约。一小时完成。 该宏应该在后台 运行,因此 STP 可以流回宏已成功启动。 长宏完成后,它使用 proc http 告诉流程引擎它已经完成。

我的问题是,当我尝试使用 rsubmit 运行 宏时,STP 在完成 运行ning 自身之前等待宏完成.

我正在使用以下简化代码来解决我的问题: 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 mymacro;
  %put Hello World;
  data _null_;
    call sleep(10,1);
  run;
%mend;

如何确保 STP 不等待宏完成? 感谢您的帮助!

_action=background 参数添加到您的 STP。例如,如果您通过 URL:

提交

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

如果您不希望整个STP在后台运行,您需要为rsubmit块创建一个单独的STP,通过proc http调用它,并且添加 action=_background 参数。

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

  <other code>;

%mend;