BookmarkSubscribeRSS Feed
Pyrite | Level 9

I want to update a protected table. Assume we have two users, and when I want to update the table, I need that second user will not open this table at the same time as me. Therefore I can use proc datasets.


The code looks like this: In the first proc step, I hold dataset_name, to prevent from second user to enter this table.

Then I update the table, and after that, I release the table. Can you see a problem with the code?


proc datasets lib= library_name;

modify dataset_name(pw=password);


data dataset_name;
set dataset_name dataset_name_new;

proc datasets lib= library_name;
modify dataset_name(pw=password);






Super User

There's two possible scenarios with regards to overwriting/updating a dataset:

  1. a user has that dataset open, eg in a viewtable. In this case, all write operations will fail.
  2. a user tries to access a dataset while you are writing to it. In that case, the user's attempt will fail until you are finished.

2) will not matter to you, but I guess that your code will still fail in 1), as SAS usually prevents all kinds of write access when a dataset is open, for whatever reason. The only method I've found (and AFAIK works only on UNIX) is to remove the target dataset with OS commands before you write to it.



Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Get the $99 certification deal.jpg



Back in the Classroom!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 2 in conversation