Four ways to schedule SAS tasks

What do you do all day long? I spend my time speaking with customers about what’s new in SAS 9.4, answering technical questions, and showing new users what they can do in SAS. You might spend your time on SAS data management tasks such as bringing in data and joining tables together, SAS analytic tasks such as building a model, or finally, SAS reporting tasks to share your insight throughout the organization.

The question is: how can we speed this up for you and give you some of that valuable time back? The answer is: by making all of these SAS processes repeatable.

The best way to make them repeatable is to take advantage of the SAS functionality for scheduling. Analysts have several options for scheduling their work to be run on a regular basis, whether it’s daily, weekly, monthly or otherwise. The options range all the way from writing SAS code, to a point-and-click GUI, to tools for IT Administrators.

1. Scheduling SAS code in batch

If you are a SAS coder, like me, you may have a lot of *.sas files on your computer. You can still schedule these pieces of code to run by setting up a batch process.

First, you will want to create a *.bat file that can be recognized by your operating system. You will need to know where SAS is installed on your local machine. You will also need to decide where to save your output (the *.lst file) and your log file (the *.log file). It is also possible to run multiple pieces of SAS code in the same *.bat file. These jobs will run consecutively. You can create the *.bat files in a text editor, like this:

Then, you will want to use your operating system (OS) scheduler to schedule the job. On my Windows 7 laptop, I use the “Task Scheduler” and select “Create Task”.

The minimum changes required are under “Triggers” and “Actions”. Under “Triggers” select “New” and make your selections appropriately. Select OK when done. Here are my selections.

Then under “Actions”, select “New” and make your selections appropriately. Select OK when done. Here are my selections.

Click OK and you are good to go! After the task has run, you can see if it was successful by checking out the “Task Status” under the Task Scheduler.

For more information, Examples of Batch Processing under Windows talks about scheduling in batch mode using your operating system.

2. Scheduling process flows or projects in SAS Enterprise Guide

Do you prefer point-and-click? SAS Enterprise Guide makes it easy to schedule your process flows or entire projects using your Windows operating system. SAS Enterprise Guide includes a built-in scheduler.

Chris Hemedinger has written on the topic, so I’ll let the expert speak for me. In his blog post Doing more with SAS Enterprise Guide automation, Chris writes about going beyond basic scheduling and taking advantage of the Enterprise Guide scheduler. He also wrote a paper on the topic: Not Just for Scheduling: Doing More with SAS® Enterprise Guide® Automation.

If you are looking for basic scheduling of Enterprise Guide process flows and projects, simply click on “File” -> “Schedule Project” or click on “Schedule” above the workspace and then select “Project” or “Process Flow”. This will open up your operating system scheduler. In my case it is using Windows Task Scheduler again. Follow the prompts from there. They are similar to what I had in example # 1 above. This is discussed in greater detail in the free chapter available for The Little SAS Book for Enterprise Guide 4.2. More information is also available in the HELP menu of SAS Enterprise Guide, under “Automating Projects”.

3. Scheduling jobs with SAS Management Console

SAS administrator? The Schedule Manager plug-in in SAS Management Console takes advantage of your operating system scheduling server. The Scheduler Manager can be used to schedule user-written SAS code or jobs that were created in SAS Data Integration Studio, SAS Marketing Automation, SAS Marketing Optimization and SAS Web Report Studio. Additionally, those batch tasks we talked about in #1? Yep, you can schedule them here, too. You are also able to create flows, which can consist of multiple SAS jobs. Most typically, the criteria for triggering the job here is Date/Time.

For more information, please see Operating System Scheduling under SAS Management Console documentation.

4. Scheduling with the Platform Suite for SAS

Need something with a little more oomph? Sometimes you need more advanced scheduling capabilities, in which case the Platform Suite for SAS can help. This feature can be used for scheduling and automating your SAS workload across a single server or a distributed grid environment. SAS Enterprise Scheduling is available as an add-on for single machine environments and is also a component of SAS Grid Manager for use in multiple machine environments. Some of the features for SAS Grid Manager include:

  • Create SAS workflows and schedule them based on time and file events
  • Combine multiple related SAS programs and other SAS jobs into a job flow
  • Define the order in which the jobs in the job flow executes
  • Specify that a job execute, or not, depending on the status of an earlier job in the flow
  • Trigger a job flow to start based on the existence or age of a file
  • Manage resource requirements and provide for load balancing through Platform LSF (Load Sharing Facility)

SAS® Scheduling: Getting the Most Out of Your Time and Resources is a great whitepaper to get you started. Please see Platform Suite for SAS for more information scheduling in a grid environment.

I hope this has been a helpful overview of your scheduling options within SAS. I also hope this frees up some of your time and your analyst’s time!

tags: SAS Administrators, scheduling


  1. Chris Hemedinger Chris Hemedinger
    Posted August 14, 2013 at 9:10 am | Permalink

    Wendy - thanks for writing on this topic. Batch jobs are a long-standing strength of SAS programs, and it's good for people to see the many ways that a job can be run/scheduled.

    • Wendy McHenry Wendy McHenry
      Posted August 14, 2013 at 9:47 am | Permalink

      Thanks, Chris! I hope that it is useful. I started off as a batch job user and now use Management Console myself, and sometimes I find folks need the more advanced features that are found in Platform Suite for SAS.

  2. Véronique
    Posted September 21, 2013 at 4:26 am | Permalink

    Dear Wendy,
    Would wou allow me to publish on my French blog on SAS a translated version of this article?
    Best Regards,

    • Posted September 25, 2013 at 3:56 pm | Permalink

      Bonjour, Veronique!
      Yes, thank you very much. I appreciate it, and I am glad you found the post useful!
      Thank you,

  3. ramnath
    Posted January 2, 2014 at 1:14 pm | Permalink

    Hi Wendy,

    Thanks for the post.

    I m using EG 4.2 and followed the steps as per little sas book.

    But problem for me is I dont have a Windows scheduler admin rights to trigger them.

    Without using windows schedules how do I run the project?

    Any help will be really helpful.


  4. Posted January 6, 2014 at 11:49 am | Permalink

    Hi Ram,
    Thanks for writing! You should not need admin rights to use the Windows Scheduler. However, you do need to ask your IT department for access to the Windows Scheduler.
    Once you have those in place, please contact SAS Technical Support for further assistance.
    Thank you!

  5. Paul Seddon
    Posted February 6, 2014 at 10:09 pm | Permalink

    Hi Wendy,

    Thanks for writing about the scheduling within SAS. I'm keen to setup some automation using an Operating System Scheduler on Linux. Everything is setup from a scheduler perspective, but I can't find any documentation on which directory I am meant to deploy my SAS batch jobs to?



    • Posted February 10, 2014 at 11:17 am | Permalink

      Thanks, Paul! From a SAS Software perspective, my understanding is that it would be your choice which directory you utilize. I would make sure you have the appropriate read/write permissions to that directory.
      Hope that helps!
      Thank you,

  6. Kapil Shahani
    Posted March 6, 2014 at 1:07 am | Permalink

    Hi Wendy,

    We use Virtual connections system to connect to our systems. Because of which we can not use Windows Scheduler as we may or may not connect to the same system on the next login. We use EG 4.2 which is set up on Unix System. Administrator rights for Unix has not been provided to us.

    I want to schedule as many as 200-300 jobs (sas programs) on the system. As I don't have Windows Scheduler and admin rights on Unix, what is the best method for me to schedule these jobs?

  7. Lynn
    Posted August 14, 2014 at 1:47 am | Permalink

    Hi Wendy,

    I've scheduled many SAS projects in SAS Enterprise Guide 4.2 in Win20003, but now my system was changed to Win2007, when I do the same schedule in “Task Scheduler” for the EGScript, but it was showing"Running" all the time, but the SAS code was not ran? Do you know the reason?

Post a Comment

Your email is never published nor shared. Required fields are marked *


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">