BookmarkSubscribeRSS Feed
cjohnson
Obsidian | Level 7
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
www.codeitmagazine.com
2 REPLIES 2
CameronLawson
Obsidian | Level 7
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
or
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
DonH
Lapis Lazuli | Level 10
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.

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 1001 views
  • 0 likes
  • 3 in conversation