BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Saugata
Obsidian | Level 7

Hi All,

I am trying to find out a graceful solution for my problem, described below:

I am opening three sas sessions using X command and noxsync option. For example I am trying to execute 3 SAS programs (abc.sas, def.sas, ghi.sas) simultaneously. That is why I am using noxsync option with X command. As expected the noxsync option is executing all 3 sas programs parallel. But since the command is reverting back to the original SAS program (the one which called the 3 sas programs, say Handler program) I do not have any knowledge from inside the handler program when these 3 sas programs have completed.

My process can go forward only when all the 3 SAS programs finish their execution, that is why it is important for me to know this. Currently I am using a solution where I check the output datasets of these 3 SAS programs and once they are created I go forward with my handler program.

But this is not a generic solution and I am wondering whether there is any pther graceful generic solution. Something inthe line of finding out when a sas session finish its execution by some mean. Whether it is possible to track their PID (process ID in windows) or sending some value back to the handler program upon its execution.

Any idea will be highly appreciated.

Thanks & Regards,

Saugata Mukherjee.

1 ACCEPTED SOLUTION

Accepted Solutions
mgst170
SAS Employee

Hi,

Does systask give you what you are after?

systask command "sas c:\one.sas" taskname=sas1 nowait;

systask command "sas c:\two.sas" taskname=sas2 nowait;

systask command "sas c:\three.sas" taskname=sas3 nowait;

waitfor _all_ sas1 sas2 sas3;

In this example, tasks 1 to 3 are submitted asyncronously, the waitfor ensures all 3 tasks are complete before the handler program can continue.

(i think the nowait might be default, but i can't recall just now).

Also, you can do simialr / more powerful things like this if you have SAS/Connect licensed.

Cheers.

View solution in original post

2 REPLIES 2
mgst170
SAS Employee

Hi,

Does systask give you what you are after?

systask command "sas c:\one.sas" taskname=sas1 nowait;

systask command "sas c:\two.sas" taskname=sas2 nowait;

systask command "sas c:\three.sas" taskname=sas3 nowait;

waitfor _all_ sas1 sas2 sas3;

In this example, tasks 1 to 3 are submitted asyncronously, the waitfor ensures all 3 tasks are complete before the handler program can continue.

(i think the nowait might be default, but i can't recall just now).

Also, you can do simialr / more powerful things like this if you have SAS/Connect licensed.

Cheers.

Saugata
Obsidian | Level 7

Thanks a lot. It worked like a charm. Actually I was not aware of this systask facility but it saved me. And yes I am aware of SAS/Connect but sadly do not have the license Smiley Sad

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
  • 1303 views
  • 1 like
  • 2 in conversation