SAS Programming Professionals,
Did you know that you can launch SAS programs from within a SAS program and suspend execution of the launching program until the launched SAS programs have complete their execution?
Doing this, you can control the execution sequence of your SAS programs if/when you do not want to depend entirely upon an OS's scheduling software such as the CRON on Linux, the Windows Scheduler on Windows, and so on.
For example, in your BIGPROGRAM.SAS program, you could have the following code:
systask command "sas your_clever_program1.sas" taskname=program1;
systask command "sas your_clever_program2.sas" taskname=program2;
waitfor _all_ program1 program2;
<<Other SAS code that processes the data sets created by the two afore-mentioned SAS programs>>
Note that the "_all_" option states that your program is to wait for both program1 and program2 to complete before resuming execution. As an alternative, you could have coded "_any_", which would have your program resume the moment either program1 or program2 completed execution.
You can probably think of a number of ingenious ways to use SYSTASK and WAITFOR to schedule the specific order for your SAS programs to execute. So, get started!
Best of luck in all of your SAS endeavors!
(aka Michael A. Raithel)
Excerpt from the book: Did You Know That? Essential Hacks for Clever SAS Programmers
I plan to post each and every one of the hacks in the book to social media on a weekly basis. Please pass them along to colleagues who you know would benefit.