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!