BookmarkSubscribeRSS Feed
helloSAS
Obsidian | Level 7


Hi,

Is there a way I can lock SAS dataset so that users cannot open it physically in PC SAS or SAS EG and yet be accessed by the SAS programs?

I have an issue where users keep SAS dataset open and our programs trying to write to the same file. Hence the job errors out. Looking for a way to fix this.

Thanks!

7 REPLIES 7
Ksharp
Super User

Yes. add a password to that table.

check dataset option pw=

or proc datasets

Doc_Duke
Rhodochrosite | Level 12

I think that what helloSAS is trying to do is to allow the PC SAS and EG users to run programs against the dataset, but not open it in spreadsheet view.  The password won't resolve that because it applies to both.  Perhaps helloSAS can clarify the need.

helloSAS
Obsidian | Level 7

I want the datasets to be locked to open it in a spreadsheet view. However the SAS jobs should have it available to read/write.

Hope this helps.

Doc_Duke
Rhodochrosite | Level 12

That's what I was afraid of.  To my knowledge, there is no SAS tool that could do that.

If you have sufficient administrative rights, you could kill the PC SAS and EG sessions.  That will be unlikely to win you any friends among the analysts...

A less brutish approach would be to maintain two copies of the data; one that you can update and another that they can read.  Then you could use system tools to copy the files when the readers are inactive.  Task scheduler can re-try every x-minutes until successful.  If the users complain about stale data, you can get them to use peer pressure on the offending analyst(s).

ChrisNZ
Tourmaline | Level 20

Or if that's an important feature, you could use sas/share.

It won't allow you to control which bit of sas opens the table and change the rights accordingly, but you can regain control of the datasets without killing sessions.

The problem you have is common btw.

A common way to deal with it is to kill all sas sessions at night unless they have a "save me" flag of some sort (like a specific file in the work directory) so that the nightly data refresh can take place.

Another method is that when a refresh fails, an automatic email is sent by the refresh job informing users that their data is not there, sorry, with an explanation.

The explanation can include the fact that xyz had the table open...  Smiley Happy

Amir
PROC Star

Hi,

Would creating views of the data which the users could access help?

Regards,

Amir.

SASKiwi
PROC Star

You might also find it useful to read through the other forum posts on this topic as it pops up frequently - search on the word lock.

While there are a number of workarounds and tricks to deal with this problem, my own personal view is that SAS should implement a more robust solution that doesn't involve buying additional software like SAS\SHARE.

However I do appreciate that this is complex issue as anyone who is aware of how relational databases handle table/row locking will concur. 

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 7 replies
  • 1256 views
  • 0 likes
  • 6 in conversation