BookmarkSubscribeRSS Feed
Obsidian | Level 7


I have the following question

Usually, when I want to do several threads at the same time and then after doing them, start a thread that uses the results of previous threads, I use the following solution

systask command "START ""Batch"" /wait /min
    ""C:\Program Files\SAS\SASFoundation\9.2(32-bit)\sas.exe"" -batch -nosplash
    -sysin ""&CodePatch.__TrRt_&NrFL._&"" -log ""&CodePatch"""

systask command "START ""Batch"" /wait /min
    ""C:\Program Files\SAS\SASFoundation\9.2(32-bit)\sas.exe"" -batch -nosplash
    -sysin ""&CodePatch.__TrRt_&NrFL._&"" -log ""&CodePatch"""

waitfor _all_   job2_for_data job3_for_data;

systask command "START /realtime ""Batch""
    ""C:\Program Files\SAS\SASFoundation\9.2(32-bit)\sas.exe"" -batch -nosplash 
    -sysin ""&CodePatch.__TrRt_&NrFL._&"" -log ""&CodePatch""";

Currently, threads run another application at different intervals and after completing them I would like to automatically analyze the results and make a report. Has the community developed any solutions for this occasion?


Tourmaline | Level 20

Maybe did you not get a response because other people, like me, do not quite understand what you are after?

In what way is what you are doing now not sufficient?

Obsidian | Level 7

The first situation well known even to beginners in parallel programming.

All tasks (task_1 to task_7) start at the same time and after the last one (task_8), eg reporting starts.

Here I know the solution to the problem.


parallel programming first situation.jpg


Second situation:

Tasks (task_1 to task_7) start at different times, independently and after the last one (task_8) the reporting begins

Here I do not know the solution to the problem


parallel programming Second situation.jpg

Tourmaline | Level 20
If the tasks are independent the common and reliable (if archaic) method is to use trigger files. When all trigger files are there the final process can start.
Obsidian | Level 7
maybe an example?!

So far I have used the %sysfunc(exist(&file)) function but sometimes I had a problem with
ERROR: A lock is not available for... 🙂
I thought maybe there is a more elegant solution
Tourmaline | Level 20

Well you need to set a trigger somewhere.

You could check for the existence of a sas data set or an environment variable, but usually an empty text file is created in a trigger directory.

This allows cross-system checks, and is easy to monitor.

if fileexist()  is what your last process tests.


Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.


Register now!

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
  • 5 replies
  • 2 in conversation