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.
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.
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.