Date: Thu, 8 Feb 2007 09:29:41 -0500
Reply-To: "data _null_;" <datanull@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "data _null_;" <datanull@GMAIL.COM>
Subject: Re: error checking on windows batch scripting and scheduling
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
You could also look into using SYSTASK.
Executes, lists, or terminates asynchronous tasks
SYSTASK COMMAND "operating system-command"
<WAIT | NOWAIT>
SYSTASK LIST <_ALL_ | taskname> <STATE> <STATVAR>;
SYSTASK KILL taskname <taskname...>;
SYSTASK allows you to execute operating system-specific commands from
within your SAS session or application. Unlike the X statement,
SYSTASK runs these commands as asynchronous tasks, which means that
these tasks execute independently of all other tasks that are
currently running. Asynchronous tasks run in the background, so you
can perform additional tasks while the asynchronous task is still
For example, to copy a SAS program, you might use this statement:
systask command "copy myprog.sas myprog1.sas"
The return code from the copy command is saved in the macro variable COPYSTAT.
That was all from the online doc. I have SYSTASK in the past on UNIX
but have not used it in the past 2 years or so that I have been
running SAS on a windows program server.
That said I could envision a SAS program that starts other SAS
programs using SYSTASK waits for them to finish examines return codes
or other expected output and starts other SAS programs depending on
the results of those returned objects.
On 2/6/07, Shanks N <email@example.com> wrote:
> This is wrt SAS 9.x on win 2k box.
> Based on the archives, I've got the .sas scripts into .bat/cmd files
> and scheduled using the windows scheduler. which goes like
> call '<path-to-sas> test1.sas
> call '<path-to-sas> test2.sas
> How do I check for success/fail of test1.sas before I run test2.sas?
> I'm not well versed in windows batch scripts and I was thinking along
> the lines of
> proc sql
> insert into jobtable
> values "test1.sas" "2007-02-04" "begin"
> <sas code>
> proc sql
> update jobtable
> set status='complete'
> where job='test1.sas' and job_date="2007-02-04"
> so in test2.sas, I'll check using sql whether
> a) test1.sas status is 'complete', create a new entry in the job table
> for test2.sas with status 'begin' and update it at the end of the
> b) if status of test1.sas is anything other than 'complete', ABEND the script.
> 1. Is this a good way to do it?
> 2. If not, what is?
> I know this method is fragile, in that when i add a new script in the
> middle of a job sequence, the scripts which are called prior and after
> to that have to be modified for the correct dependency.
> I really can't see any other way as I'm not allowed to install third
> party schedulers(if any) on the win 2k box.
> p.s. would appreciate a small ABEND/ABORT example for sas on windows.