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?

  8. Con
    Posted July 19, 2015 at 11:10 am | Permalink

    Hi Wendy
    Very helpful post thank you. How would one find the path for the sas.exe of university edition? Or basically to create a *.bat file like option one. I can't imagine localhost:10080 working.
    Thank you

  9. Kelsey
    Posted August 7, 2015 at 8:38 am | Permalink

    Wendy - thank you so much for this information!

    I am using the Windows Task Scheduler (option 1) and my program successfully runs if I double click the .bat file, and when I run it manually in base SAS. However, when the scheduler automatically invokes the .bat file, I get a pop up saying that "pcfserver.exe has stopped working" and my program fails. My program is not complicated, it is just a PROC IMPORT of a .xlsx file. My SAS is older, version 9.2.

    The issue happens in SAS Enterprise Guide. I can run the PROC IMPORT manually as a program, and it is successful. However, when I run it as a process flow, I get the pop up "pcfserver.exe has stopped working" and my program fails.

    Any ideas on how to fix it? I do have the PC Files Server component installed (which is how I am able to successfully run the program manually). It seems to be when I use another application to execute the program, I get the error.

    Thanks so much!

    • Posted August 7, 2015 at 9:00 am | Permalink

      Hi Kelsey,

      To run the program as written, it will need the SAS Access Engine to PC File Formats installed and licensed in the location where it is running.

      If you do have the SAS Access Engine to PC File Formats installed there, your best bet is going to be to contact SAS Technical Support to fix the issue.

      I hope that helps!

      Thank you so much,


  10. Mandy
    Posted October 9, 2015 at 11:17 am | Permalink

    I have to schedule a SAS job (which was earlier running by TIDAL) into Cronacle. The .sas file is called by within a .bat file, I guess its option 1 from this post.
    Is anybody aware of any special considerations to schedule a SAS job of Windows server into Cronacle.
    There is a %errorlevel% check in the batch file and that gives a value 301, thereby aborting the program. Please note that if not run through Cronacle, the sas job runs absolutely fine so it might not be a code error.

    I am getting the following error message in standard output file

    Error: OCS environment variable not set
    Any thoughts and suggestions are appreciated

  11. Diana
    Posted November 18, 2015 at 12:56 pm | Permalink

    Hi Wendy,
    I am currently trying to automate few SAS EG reports. I scheduled the SAS EG project from which a VBScript is generated. Then I wrote a batch file with cscript.exe path(from local system) and the Vb script path which generated from SAS EG project.
    Till now I have tested and everything is good, reports are getting generated in my designated folder automatically. Till now I tested them on my local system, Windows task scheduler and it worked fine.
    And now my question to you is..., I will be using the batch file and integrate it with Tidal scheduler in the server.
    What are the things which needs a change for running the reports on a server automatically. Please need your help on this.
    Thanks a lot in advance...

    • Posted November 19, 2015 at 2:12 pm | Permalink

      Hi Diana,

      With the information you've provided, here are the things I would make sure you have on the server:

      * All the same SAS components licensed and installed on the server as you had on your PC.

      * Find the location where you need the SAS code to be stored, any libraries created in SAS Metadata, and any locations where you need any output to be placed.

      * Open the Enterprise Guide project on the server side, and go into Project Maintenance. From this screen, you can update the libraries and the server where the project is running.

      * Update any libraries and folder locations to be those on the server.

      I hope that is helpful! For further assistance, I'd recommend reaching out to SAS Technical Support who can help also.



      • Kyle Fredette
        Posted November 25, 2015 at 11:43 am | Permalink

        Hi Wendy - My group currently operates strictly within SAS EG GUI and want to schedule our projects on our existing server. Will we need to integrate SQL code to made this work, or can we use start and kill commands to kick off an ordered list? Our server is currently set up to open projects that are built with SQL code and not using the GUI. Let me know if you need any more information and thank you!


  12. Lee
    Posted April 6, 2016 at 4:18 pm | Permalink


    When you schedule a sas program in batch, or schedule a project in EG, will the program run in the background, or do you need to have EG running on your local machine?


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=""> <s> <strike> <strong>