accessing the table in different SAS code created in different session

Accepted Solution Solved
Reply
Contributor
Posts: 60
Accepted Solution

accessing the table in different SAS code created in different session

Hi,

I am trying to run SAS code using shell script.There are 4 code called by master script.I have used wait function in shell script.after completing my first Script then only rest of the code will triger.

In my first sas code,I am creating a dataset which will be used by other 3 sas code.which will be running parallel.

But some how after completing the first code and creating data set the other 3 code can't able to see the dataset.

Can I anyone let me know to how to Identify dataset in 2,3,4 sas code which is running by shell script.


Accepted Solutions
Solution
‎11-19-2014 08:39 AM
Super User
Posts: 7,762

Re: accessing the table in different SAS code created  in different session

Posted in reply to PravinMishra

Put your important dataset into a permanent library like sasuser, or assign a libname to a permanent directory in every SAS job (or put the libname in autoexec.sas) of that group.

The shell script may look like:

sas job1.sas

# the script will wait for the completion of this one

sas job2.sas&

sas job3.sas&

sas job4.sas&

wait

Now the jobs 2-4 will run concurrently, and the script will exit after all have finished.

Be sure that none of the jobs 2-4 try to _write_ to the dataset.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers

View solution in original post


All Replies
Super User
Posts: 11,343

Re: accessing the table in different SAS code created in different session

Posted in reply to PravinMishra

Did you create the data in a permanent library (instead of WORK)? Do the other scripts have access to the permanent library (appropriate LIBNAME statement)?

Contributor
Posts: 60

Re: accessing the table in different SAS code created in different session

No , I am creating the data in that session as they are temp data which I not required.

Super User
Posts: 11,343

Re: accessing the table in different SAS code created  in different session

Posted in reply to PravinMishra

Temp data is likely going to be session specific. Started by different shells means different instances of SAS and hence a different work library. So no data.

Perhaps you need a master SAS program that runs in one instance and calls the other SAS programs using %include:

%include "<path>/script1.sas";

%include "<otherpath>/script2.sas";

for instance would call the first SAS program file and then the second and the second would be in the same session and access the same temporary files.

Contributor
Posts: 60

Re: accessing the table in different SAS code created  in different session

Could it be possible to run it parallel?rather than one by one.I tried with rsubmit but it's not working

Solution
‎11-19-2014 08:39 AM
Super User
Posts: 7,762

Re: accessing the table in different SAS code created  in different session

Posted in reply to PravinMishra

Put your important dataset into a permanent library like sasuser, or assign a libname to a permanent directory in every SAS job (or put the libname in autoexec.sas) of that group.

The shell script may look like:

sas job1.sas

# the script will wait for the completion of this one

sas job2.sas&

sas job3.sas&

sas job4.sas&

wait

Now the jobs 2-4 will run concurrently, and the script will exit after all have finished.

Be sure that none of the jobs 2-4 try to _write_ to the dataset.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Contributor
Posts: 60

Re: accessing the table in different SAS code created  in different session

Posted in reply to KurtBremser

Thanks KurtBremser for your valuable solution.

🔒 This topic is solved and locked.

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

Discussion stats
  • 6 replies
  • 300 views
  • 3 likes
  • 3 in conversation