Schedule a SAS Task using Task scheduler in Windows 7

Reply
Contributor
Posts: 27

Schedule a SAS Task using Task scheduler in Windows 7

Hi All,

I am trying to schedule a SAS task to run automatically every day, using the task scheduler. I was able to do this comfortably in windows XP.The first step in task scheduler in XP is to locate the SAS software and there by telling the task scheduler where to execute the program. How ever the setuo is completely changed in windows 7. Can any one help me in doing this. thanks in advance.

Contributor
Posts: 73

Schedule a SAS Task using Task scheduler in Windows 7

Contributor
Posts: 27

Schedule a SAS Task using Task scheduler in Windows 7

The instructions were very generic and I followed them. The task started running at the scheduled time, but the program did not execute.

PROC Star
Posts: 7,429

Schedule a SAS Task using Task scheduler in Windows 7

The first line of the microsoft help page stated that you had to have been logged on as an Administrator.  Were you when you created the task?

Contributor
Posts: 27

Schedule a SAS Task using Task scheduler in Windows 7

Yes I am the administrator priviliges on the computer and I am running the task with highest priviliges.

PROC Star
Posts: 7,429

Schedule a SAS Task using Task scheduler in Windows 7

Contributor
Posts: 27

Schedule a SAS Task using Task scheduler in Windows 7

This code might run once i follow the instructions in the link. However my main task here is to schedule this to happen every day automatically.

PROC Star
Posts: 7,429

Schedule a SAS Task using Task scheduler in Windows 7

Sorry, I hadn't read the page prior to posting.  The following one looks like it may actually provide some things you may not have considered: http://www.lexjansen.com/pharmasug/2011/ad/pharmasug-2011-ad11.pdf

Contributor
Posts: 27

Schedule a SAS Task using Task scheduler in Windows 7

I used the folowing on a bat file and executed it through task sccheduler -

start/w C:\Program Files (x86)\SAS\SAS 9.1\sas.exe –sysin \\Program location\BATCH18140.sas

However it gave me an error saying windows cannot find C:\program. Please correct the name and run again. Can some one let me know where I ma going wrong.

PROC Star
Posts: 7,429

Schedule a SAS Task using Task scheduler in Windows 7

If you look at the paper I referred to, it shows the following example:

start/w C:\”Program Files”\SAS\v9\sas.exe –sysin \\SAS code location\test.sas -NOSPLASH -PRINT \\SAS output

location\test.lst -LOG \\SAS log location\test.log

I presume, like the above example, that "Program Files" has to be encased in double quotes because it contains a space.

Contributor
Posts: 54

Schedule a SAS Task using Task scheduler in Windows 7

Art297 is right,

To be on the safe side, you can enclose the entire path:
"C:\Program Files\SAS\SAS 9.1\sas.exe"

So the whole thing might look like:

"C:\Program Files\SAS\SAS 9.1\sas.exe"  -icon -noterminal -nosplash -noxwait -noxsync -CONFIG  "C:\Program Files\SAS\SAS 9.1\SASV9.CFG" -SYSIN "C:\Documents and Settings\My Documents\ScheduledProgram.sas" -LOG  "C:\Documents and Settings\My Documents\ScheduledProgram.log"

Note that when using this method, your log will be overwritten each day.

Contributor
Posts: 27

Schedule a SAS Task using Task scheduler in Windows 7

start/w "C:\Program Files (x86)\SAS\SAS 9.1\sas.exe" -CONFIG "C:\Program Files (x86)\SAS\SAS 9.1\nls\en\SASV9.CFG" -SYSIN "\\USEWRNAS01\Biometrics$\sasprgms\BATCH.sas" -LOG  "\\USEWRNAS01\Biometrics$\sasprgms\BATCH.log"

I am using the above , however it gives me an error windows cannot find '-CONFIG'. Please make sure the name is typed correctly. I am not sure if I am missing something here. If I use other options such as -icon, it gives same error saying - windows cannot find '-ICON'

Contributor
Posts: 54

Schedule a SAS Task using Task scheduler in Windows 7

I'm not sure what the issue is, but a few things to try might include:

-remove the "start/w" from your code. I don't have it in mine and it works.

-make sure there are no carriage returns in your code

-make sure you are using the right config file. Do a search for *.cfg and see if anything else returns

Good luck!

Contributor
Posts: 27

Schedule a SAS Task using Task scheduler in Windows 7

Thanks Art297 and Mishka. The program finally worked if I remove the Start\w command in bat file.

Occasional Contributor
Posts: 5

Re: Schedule a SAS Task using Task scheduler in Windows 7


Following the problem which Madhu had,  i am also facing the same problem however the task scheduler in windows 7 works fine to run the sas program at a schedule time but just opens the program without running it and  which i would like to run at the same time.

thanks in advance !

Ask a Question
Discussion stats
  • 24 replies
  • 15227 views
  • 2 likes
  • 7 in conversation