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-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 955 views
  • 0 likes
  • 2 in conversation