Your SAS programs, embedded in web apps and elsewhere

Schedule process after event

Frequent Contributor
Posts: 97

Schedule process after event

I am working with my IT department to try to set up a way to run reports after the data source is refreshed. Currently, the data refreshes daily and monthly, and after each refresh, a file is placed on the server so other programs can be triggered to run. My question is, can SAS be set up to recognize that a file has been placed on a server, or check a table for an update, in order to trigger a SAS routine?
Christopher Johnson
Posts: 66

Re: Schedule process after event

Are you using EBI?

If so, then LSF allows you to set up dependencies such as time events, file events or job events. For example, two of my jobs at work do the following;
4 DI jobs execute at a certain time.
when all four jobs have completed another 6 jobs run.
at another time (8pm) another 3 jobs start running because users are no longer entering data.
when all jobs have completed, another job runs. This produces a file on our server

The second job looks for this file and when it is created, the job fires and deletes the text file from the previous job.

If you are not using EBI/LSF then you could either;

1. Look at sashelp.vtable or do a proc contents to check the modified date of the file
2. Set up a systask command, x command or filename pipe to execute an operating system process that checks for the existence of a file.

3. Have your report(s) wrapped with a macro that uses the sleep function. This will halt execution for a given period. Depending on your choice of validation, you will need to do a periodic check that the condition you set has been met. (either table is updated by looking at dictionary tables or the file exists). When the condition is true, execute reports.

Hope that makes sense. Message was edited by: Cameron Lawson
Frequent Contributor
Posts: 148

Re: Schedule process after event

Why don't you use a directory watch utility that can trigger the execution of a process upon creating or editing a file in a directory. For example, you could have a command file run SAS on the subject file.
Ask a Question
Discussion stats
  • 2 replies
  • 3 in conversation