How to Create/Delete a Scheduled Job in SAS Viya
The following procedure outlines steps to schedule/unschedule jobs, delete a job, and view the properties of jobs. Jobs can be scheduled to run either immediately, at a specific time (daily, yearly), or in response to a trigger.
Note: Background jobs run on a separate workspace server, and as a result the log is not displayed “live” in the same main Log window as running code directly within SAS Studio using the Run icon. Additionally, any libraries that are created by your background program will not appear in the Libraries section of the SAS Studio.
Using SAS Studio to Schedule a Job
Jobs can be scheduled using SAS Studio.
1. Open SAS Viya.
2. Go to SAS Studio.
3. Right click on the code to be scheduled as a job and select Schedule as a job.
4. To create a New Trigger, enter Name, Frequency, Interval, Time, Time zone, Start date, and End type. Click Save.
Note: If users want their job to run only once, they can change the End type to After number of times and select 1 for the number of times.
5. Job can be viewed in SAS Environment Manager.
Using Environment Manager to Schedule a Job
- Open SAS Viya.
- Go to Manage Environment.
3. Click the Jobs icon on the left panel.
4. Click the Scheduling tab.
5. Click the New drop-down menu and select Job.
6. Enter name of the New job, then click the Browse icon.
7. Locate the SAS file the job will run. Select the job and click OK.
8. Click OK to save the job.
9. Right click on the job name and select Schedule.
10. Click the plus sign to add a new trigger.
11. To create a New Trigger, enter Name, Frequency, Interval, Time, Time zone, Start date, and End type. Click Save.
12. Click Save.
Note: Prior to saving, additional triggers can be created.
Note: Once the job is complete, the entire log file is written to a user's folder of choice. The output folders can be changed in Options > Preferences > Background Submit.
If the code is running too long in background mode and encountering errors, then steps can be added manually throughout the SAS code to stop the program from running once the conditions are met (e.g., if _ERROR_ = 1 then abort return; to stop the SAS session). Once the SAS code stops running, the SAS log can then be opened in full.
Deleting a Job
1. Open SAS Viya.
2. Go to the list of Jobs in SAS Environment Manager.
3. Right click on the relevant job and click Delete.
4. Click Yes, when prompted to confirm the deletion.
View the Properties of Jobs
1. Open SAS Viya.
2. Go to the list of Jobs in SAS Environment Manager.
3. Right click on the job name and select Properties.
Related articles