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?
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
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.
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.