DATA Step, Macro, Functions and more

How to Keep track of a SAS session opened using X command and noxsync option

Accepted Solution Solved
Reply
Contributor
Posts: 35
Accepted Solution

How to Keep track of a SAS session opened using X command and noxsync option

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.


Accepted Solutions
Solution
‎01-12-2012 04:25 AM
SAS Employee
Posts: 11

How to Keep track of a SAS session opened using X command and noxsync option

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


All Replies
Solution
‎01-12-2012 04:25 AM
SAS Employee
Posts: 11

How to Keep track of a SAS session opened using X command and noxsync option

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.

Contributor
Posts: 35

How to Keep track of a SAS session opened using X command and noxsync option

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

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 210 views
  • 1 like
  • 2 in conversation