| Date: | Wed, 7 Apr 2010 09:20:50 -0500 |
| Reply-To: | "Data _null_;" <iebupdte@GMAIL.COM> |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | "Data _null_;" <iebupdte@GMAIL.COM> |
| Subject: | Re: Running SAS batch programs asynchronously |
|
| In-Reply-To: | <x2lce1fb7451004070512q67087775l6e07675b57b7a0b7@mail.gmail.com> |
| Content-Type: | text/plain; charset=ISO-8859-1 |
|---|
I've modified my SYSTASK example to use a run list that I suggested
would be adequate. I just use CARDS for the run list but the data
could come from another source. The only thing you need is the
RANK(group and order) and the program path. Again I used current
directory to simplify the path.
I also use a "trick" to stop execution if a bad status is found. I
would normally use ENDSAS, but I want the example to work in DM.
You could also use macro to run the whole thing, dealers choice.
* Create the run list.;
data runlist;
input rank path $char50.;
cards4;
1 phil1.sas
1 phil2.sas
2 phil3.sas
3 phil1.sas
;;;;
run;
** Everything happens in the current directory;
** Create some SAS programs;
** Phil2 has a bug. If you fix Phil3 will run.;
data _null_;
input file $char5. +1 line $char50.;
filevar = catx('.',file,'SAS');
file dummy filevar=filevar;
put line $char50.;
cards4;
phil1 proc options;
phil1 run;
phil1 data _null_; rc=sleep(3); run;
phil2 data _null_; rc=sleep(3); run;
phil2 data test;
phil2 set sashelp.class;
phil2 x = 1*;
phil2 run;
phil3 proc datasets library=sashelp;
phil3 run;
phil3 data _null_; rc=sleep(3); run;
;;;;
run;
** Used to stop the program. I would normally just
use ENDSAS but I want the program to work in DMS.
This file will be conditionally %INCed;
filename FT15F001 temp;
parmcards4;
/* Bad status NO more programs will execute
;;;;
filename FT57F001 temp;
data _null_;
file FT57F001;
retain sas 'C:\Program Files\SAS\SAS 9.1\sas.exe';
length taskname status $8;
length taskList statusList $32767;
retain n 0;
put 'skip 5;';
do n = (n+1) by 1 until(last.rank);
set runlist end=eof;
by rank;
taskname = cats('STask',n);
status = cats('STask',n);
tasklist = catx(' ',tasklist,taskname);
statusList = catx(' ',statusList,cats(status,'=&',status,';'));
put 'systask command ''' sas:$quote50. path:$quote50. +(-1) '''
' taskname= status= +(-1) ';';
output;
end;
put 'waitfor _all_ ' tasklist +(-1) ';';
put 'data _null_;';
put +3 statuslist;
put +3 'putlog "NOTE: STATUS of task: " (STask:)(=);';
put +3 'if sum(of STask:) gt 0 then do;';
put +6 'error "ERROR: Bad status no more programs will execute";';
put +6 'call execute("%inc FT15F001 / source2;");';
put +6 'end;';
put +3 'else putlog "NOTE: Status is good we will keep going";';
put +3 'run;';
if eof then do;
call execute('%inc FT57F001 / source2;');
call execute('*/;');
stop;
end;
run;
On 4/7/10, Data _null_; <iebupdte@gmail.com> wrote:
> On 4/6/10, Scott Bass <sas_l_739@yahoo.com.au> wrote:
> > However, I am hoping to put an architecture in place to allow end users to
> > modify the list of programs to run with minimal effort.
>
> That shouldn't be difficult no matter what method you choose to run
> the programs.
>
> A simple list of names with a rank to identify the order the programs
> are run, ties would indicate programs that can be run in groups (at
> the same time if you like).
>
> rank path
> 1 a.sas
> 1 b.sas
> 2 c.sas
> 3 d.sas
> 3 e.sas
>
|