DATA Step, Macro, Functions and more

Way of catch dataset is opened or not.

Accepted Solution Solved
Reply
Contributor
Posts: 35
Accepted Solution

Way of catch dataset is opened or not.

Is there any way that I can determine whether the dataset is open or not?

For example, If I open the dataset "x" in the work library,which means there is a window which title bar is "VIEWTABLE: work.X".
In this situation,I exist below code

data work.x;
yy = 1;
run;

There's a ERROR log saying "member-level control" etc., you know.


To avoid this, I'm looking for a way to grasp how this data set is open before casting the dataset(work.x) to DATA step.

 

I know "open" function,which is for open dataset.This time I'm looking "opened" or not.

I asked “Google” but it seems no answer.

sas_dataset_opend.JPG

Sincerely,


Accepted Solutions
Solution
‎10-16-2016 03:38 AM
Super User
Posts: 19,829

Re: Way of catch dataset is opened or not.

Posted in reply to t_ar_taat

The first paper in your google search is appplicable isn't it?

Try to open/lock the file and you'all get an error code if file is already opened. 

The FOPEN function()

View solution in original post


All Replies
Solution
‎10-16-2016 03:38 AM
Super User
Posts: 19,829

Re: Way of catch dataset is opened or not.

Posted in reply to t_ar_taat

The first paper in your google search is appplicable isn't it?

Try to open/lock the file and you'all get an error code if file is already opened. 

The FOPEN function()

Contributor
Posts: 35

Re: Way of catch dataset is opened or not.

Reeza,Thank  you for your kindness every time.

Oops,actually  if "open" function returns error,it means the dataset is opened.Thanks.

Respected Advisor
Posts: 4,173

Re: Way of catch dataset is opened or not.

[ Edited ]
Posted in reply to t_ar_taat

In case you've started looking into this because you have some sort of a control/log table where multiple processes insert or update in parallel (so only short lock of the table per process) then have also a look into option FileLockWait as this will make the locking issue "go away" for such use cases.

Contributor
Posts: 35

Re: Way of catch dataset is opened or not.

Thank you,Patrick.
I haven't seen "FILELOCKWAIT" System Option,so I'll check it.

☑ This topic is solved.

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

Discussion stats
  • 4 replies
  • 326 views
  • 0 likes
  • 3 in conversation