Need Help setting up SAS 9.2 Program on Windows Task Scheduler on Windows Server 2008 Standard

Accepted Solution Solved
Reply
Contributor
Posts: 61
Accepted Solution

Need Help setting up SAS 9.2 Program on Windows Task Scheduler on Windows Server 2008 Standard

Has anyone had experience troubleshooting Windows Task Scheduler on the Windows Server 2008 Standard operating system?  Microsoft MSDN documentation on this scheduler is poor.  I can' get anywhere trying to troubleshoot on that end.  There are no error messages in the event log from the scheduler.  The event log messages said "action and task completed successfully", but I got no output report emailed to me from the program and no SAS log in the appropriate folder I have setup for SAS Logs.  I have used this program on an older server in the 32-bit world, and it worked fine.    We have recently upgraded and moved everything to a new server running Windows Server 2008 Standard 64-bit operating system.  All permissions and service accounts have been verified as functional.  Triggers are enabled.  If I run the report on the new server manually thru a remote submit, it works fine.  I want to automatically open SAS and run this program daily at pre-determined times of the day and certain days of the week.  In this SAS program are a number of  %INCLUDE  statements that will execute other programs, only if the time and date values are true.

Below is a screenshot of the Task Scheduler Wizard in Windows Server 2008 Standard, ACTION Tab where I told the wizard to "Start a Program", and in Details section, I gave the path to the program "E:\ccsas1\dhub\Data Requests\SCHED_JOBS.sas".     Below this picture is an excerpt from the first part of the actual program.

Windows Task Scheduler Screen View2.gif

  Here is an excerpt of the first part of the program:

       

***   Run scheduled jobs - the scheduler runs 1st time at 9 a.m., also at 11, 1, 3 every day. ;

libname warehous '\\ROCPSASCRMS\ccsas1\dhub\warehouse' ;

options fmtsearch = (warehous) ;

options source source2 mautosource

        sasautos=("\\ROCPSASCRMS\ccsas1\dhub\sas\macros","\\ROCPSASCRMS\ccsas1\SAS_Programs\Macros\AutoCall",

                  "\\ROCPSASCRMS\ccsas1\SAS_Programs\Macros\Snippets", sasautos);

filename schdlog '\\ROCPSASCRMS\ccsas1\dhub\Tech - process\logs\Daily\Sched_job.log' ;

proc printto log=schdlog new ;

run;

data _null_ ;

   hour=hour(time());

   wd=weekday(today()) ;

   dom=day(today()) ;

   call symput('hour',hour) ;

   call symput('wd',wd) ;

   call symput('dom',dom) ;

run;

%macro dlyrqst ;

  %if (&wd ne 7 and &wd ne 1) or (&hour = 11) %then

     %do;

       %include '\\ROCPSASCRMS\ccsas1\dhub\Tech - process\pgms\Scheduled\data request process.sas' ;

     %end;

%mend ;

%dlyrqst ;

***  runs at 5 p.m. TEST FOR 5 PM RUN ON 9_26_2011 ;

%macro mtdinput ;

  %if &hour = 17 and &wd ne 7 and &wd ne 1 %then

     %do;

       %include '\\ROCPSASCRMS\ccsas1\dhub\Tech - reporting\pgms\Daily\bus_banking_new_input_report.sas' ;

  %end;

%mend ;

%mtdinput ;


Accepted Solutions
Solution
‎09-28-2011 09:24 PM
Trusted Advisor
Posts: 1,301

Re: Need Help setting up SAS 9.2 Program on Windows Task Scheduler on Windows Server 2008 Standard

Just giving the scheduler a sas file does not mean it will know what to do with that file.  You need to enter a validate sas batch job command, or create a vbs script to start a sessin and do your submission.  The details should look something more like

C:\Program Files\SAS\SASFoundation\9.2\sas.exe -batch -sysin E:\ccsas1\dhub\Data Requests\SCHED_JOBS.sas

View solution in original post


All Replies
Trusted Advisor
Posts: 2,116

Need Help setting up SAS 9.2 Program on Windows Task Scheduler on Windows Server 2008 Standard

I don't use a windows server, but I might hazard a guess that the server does not know about the e:-drive mapping if you are not logged in and running interactively.  Try using the UNC name ( \\server-whatever\....),  Alternatively, try a simple batch command through the scheduler that is a file on the e:-drive.

Doc Muhlbaier

Duke

Solution
‎09-28-2011 09:24 PM
Trusted Advisor
Posts: 1,301

Re: Need Help setting up SAS 9.2 Program on Windows Task Scheduler on Windows Server 2008 Standard

Just giving the scheduler a sas file does not mean it will know what to do with that file.  You need to enter a validate sas batch job command, or create a vbs script to start a sessin and do your submission.  The details should look something more like

C:\Program Files\SAS\SASFoundation\9.2\sas.exe -batch -sysin E:\ccsas1\dhub\Data Requests\SCHED_JOBS.sas

Contributor
Posts: 61

Re: Need Help setting up SAS 9.2 Program on Windows Task Scheduler on Windows Server 2008 Standard

Hey FriedEgg,

          Thanks for your input.  I implemented your suggestions into a batch file and  put the path to it in the actions tab of the Windows Task Scheduler.  The message I got was "Windows can't find -batch".  I talked to someone here, and they suggested that I delete the text "-batch" and re-run it.

Now it says Windows can't find "-sysin".  Please help me with this syntax.  By the way, here is the batch file text I created.

start/w "C:\Program Files\SAS\SASFoundation\9.2\sas.exe"  -sysin "\\rocpsascrms\ccsas1\dhub\Data Requests\SCHED_JOBS.sas"

  -log "\\rocpsascrms\ccsas1\dhub\Data Requests\SCHED_JOBS.log" -print "\\rocpsascrms\ccsas1\dhub\Data Requests\SCHED_JOBS.lst"

  -noterminal -nologo

When Windows ran this process, Windows changed the path from "\\rocpsascrms\..."  to "E:\ ..." (see below)

start/w "C:\Program Files\SAS\SASFoundation\9.2\sas.exe"  -sysin "E:\ccsas1\dhub\Data Requests\SCHED_JOBS.sas"

  -log "E:\ccsas1\dhub\Data Requests\SCHED_JOBS.log" -print "E:\ccsas1\dhub\Data Requests\SCHED_JOBS.lst"

  -noterminal -nologo

Trusted Advisor
Posts: 1,301

Re: Need Help setting up SAS 9.2 Program on Windows Task Scheduler on Windows Server 2008 Standard

The problem is your usage of the start command, I believe.  There is no real reason to use it here either?  Try this bat file:

sched_jobs.bat

for /F "tokens=2,3,4 delims=/ " %%i in ('date/t') do set d=%%i%%j%%k

for /F "tokens=1,2,3 delims=:. " %%i in ('time/t') do set t=%%i%%j%%k

"C:\Program Files\SAS\SASFoundation\9.2\sas.exe" -batch -nologo -sysin "E:\ccsas1\dhub\Data Requests\SCHED_JOBS.sas" -log "E:\ccsas1\dhub\Data Requests\SCHED_JOBS_%d%_%t%.log" -print "E:\ccsas1\dhub\Data Requests\SCHED_JOBS_%d%_%t%.lst"

I have no way to test any of this however since I don't use Windows...

Contributor
Posts: 61

Need Help setting up SAS 9.2 Program on Windows Task Scheduler on Windows Server 2008 Standard

Thanks so much, for your help, Lawrence Muhlbaier.  I will make those adjustments.

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 5 replies
  • 876 views
  • 5 likes
  • 3 in conversation