BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Wang_Yajun
Obsidian | Level 7

I'm now using SAS9.2, and I want to get my sas code run automatically to do some rountine work, is there any possible way? Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
Kurt_Bremser
Super User

The handling of the Windows Task Planner is described here:

http://www.digitalcitizen.life/how-create-task-basic-task-wizard

 

I would advise to create a batch file first that runs SAS with your program.

It should contain a line with something like this:

"C:\Program Files\SAS\SASFoundation\9.2(32-bit)\sas.exe" -sysin insert_program_here.sas -log where_you_want_a_log.log

 

Test this batch file from the cmd window first to see if it works, then use the Task Planner to create a scheduled event that runs the batch file.

View solution in original post

7 REPLIES 7
Kurt_Bremser
Super User

Mostly depends on your setup. If you have SAS on a server, that server will provide a scheduling tool.

What you need is a script (batch, whatever your system wants) that runs SAS in batch mode with the supplied program.

 

Enterprise Guide already provides a method to create a job for a project so that the Windows scheduler can run it.

Wang_Yajun
Obsidian | Level 7

Hi,KurtBremser

Thanks for your reply. I don't have SAS EG on my personal PC. I have SAS 9.2 BASE installed in my PC, and my system is WIN7. I wonder if I can use base SAS code to get the SAS file run automatically . If not, could you give a sample script that can get the job done? Thanks a lot.

Kurt_Bremser
Super User

The handling of the Windows Task Planner is described here:

http://www.digitalcitizen.life/how-create-task-basic-task-wizard

 

I would advise to create a batch file first that runs SAS with your program.

It should contain a line with something like this:

"C:\Program Files\SAS\SASFoundation\9.2(32-bit)\sas.exe" -sysin insert_program_here.sas -log where_you_want_a_log.log

 

Test this batch file from the cmd window first to see if it works, then use the Task Planner to create a scheduled event that runs the batch file.

Kurt_Bremser
Super User

BTW, you should take a look at your SAS install media. EG is usually included with Base SAS and works with a locally installed SAS without need for additional server processes (Metadata, Spawner).

LinusH
Tourmaline | Level 20

This is a guide for SAS 8/Win2K.

I think it still applies, even if some windows/search paths may be different from your setup.

 

http://support.sas.com/techsup/technote/ts648.pdf

 

Hope it isn't important stuff it should do, doesn't sound too reliable to execute batch jobs on a client PC.

Data never sleeps
Wang_Yajun
Obsidian | Level 7

Hi, LinusH

 

Thanks for your reply, I help me a lot. 

Kurt_Bremser
Super User

Linus,

 

since his "client PC" also holds the core SAS software, I guess it is of a workstation type and is supposed to run round the clock. I also guess that scheduling in this context isn't so much a production thing and time-critical, but more of a personal helper.

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 7 replies
  • 6267 views
  • 4 likes
  • 3 in conversation