Running multiple requests at the same time in SAS

I have 36 completely independent queries that I need to run on regular databases, which will work much faster if they can run 3 at a time (the database cancels our queries if we try to do more than 3 at a time) instead of each of which awaiting completion of the previous one.

I would like to do something like this

/* Some prep code here*/

/* Launch batch 1 containing queries 1-12*/
/* Immediately launch batch 2 (13-24) without waiting for 1-12 to finish*/
/* Immediately launch batch 3 (25-36)*/

/* Wait until all 3 batches are done and run some conclusion code*/

Or, if possible, just pass it 36 ​​queries together and run it at a time, without thinking that you should not have more than three starts at any given time, and at any time, when done, just add the next one from the stack.

Can this be done using SAS?

thank

+3
source share
3

, SAS, . ( , , rsubmit , ) SAS/Base 3 , . ,

option autosignon=yes;
option sascmd="!sascmd";

* some random data;
data prova1;
do i=1 to 20000000;
    x=rand('UNIFORM');
    output;
end;
run;

data prova2;
do i=1 to 20000000;
    y=rand('UNIFORM');
    output;
end;
run;
*open connection to the server ;

options comamid=tcp;
filename rlink "D:\SAS\SASFoundation\9.2\connect\saslink\tcpwin.scr";
%LET host1=nbsimbol59;
%LET host2=nbsimbol59;

signon remote=host1 script=rlink;
signon remote=host2 script=rlink;

rsubmit process=host1 wait=no inheritlib=(work=cwork);; 

   proc sort data=cwork.prova1 out=cwork.r1;
     by x;
   run;

   proc sort data=cwork.r1 out=cwork.r1a;
     by i;
   run;


endrsubmit;


rsubmit process=host2 wait=no inheritlib=(work=cwork);; 

   proc sort data=cwork.prova2 out=cwork.r2;
     by y;
   run;

   proc sort data=cwork.r2 out=cwork.r2a;
     by i;
   run;

endrsubmit;

/* Wait for both tasks to complete. */
waitfor _ALL_ host1 host2;

data r9;
     merge r1a (in=a) r2a (in=b);
    by i;
    if a and b;
    run;


signoff host1;
signoff host2;

, , atm , , , , .

3 , , 3 . :)

+3

(, Windows UNIX), SAS , SYSTASK , . WAITFOR - :

systask command "sas prog1.sas" taskname=sas1;
systask command "sas prog2.sas" taskname=sas2;
systask command "sas prog3.sas" taskname=sas3;
waitfor _all_ sas1 sas2 sas3; /* suspend current session until the three jobs are finished */

. SYSTASK WAITFOR ( Windows).

+2

Source: https://habr.com/ru/post/1761198/


All Articles