BookmarkSubscribeRSS Feed
makset7
Obsidian | Level 7

Hello

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._&Period._1_1_.sas"" -log ""&CodePatch"""
    taskname=job2_for_data;

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

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._&Period._1_0_DL.sas"" -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?

 

5 REPLIES 5
ChrisNZ
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?

makset7
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

ChrisNZ
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.
makset7
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
ChrisNZ
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.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 5 replies
  • 1231 views
  • 0 likes
  • 2 in conversation