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);
quit;
data dataset_name;
set dataset_name dataset_name_new;
run;
proc datasets lib= library_name;
modify dataset_name(pw=password);
quit;
There's two possible scenarios with regards to overwriting/updating a dataset:
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.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.