dear all:
Recently,I was confused about "A lock is not available for <dataset>".Indeed ,it's an error,but when I restart SAS and run the code again ,the error disappeared.How to avoid the error?
When I review my code,I guess 5 possibilities may cause this error, right or wrong?
*1.set options compress=yes;
options compress=yes;
*2.in data step,input dataset and the output dataset have the same name;
data X;set X ;run;
*3. when using proc sort ,without out= option;
proc sort data=x;by id;run;
Any suggestion is welcome!
Another thing that can keep a file handle open is anti-virus software which immediately scans all newly created files and prevents an overwrite (or even opens exclusively).
SAS throws this error if a different process locks a table (the SAS file). In your case though the tables are in WORK and that is SAS session specific (=same process).
What can lock a table even in WORK is if you have it already open in your EG session. Below option setting helps to avoid this.
For the 3 cases you mention:
Option compress will never lock a table.
In your sample code the tables are in WORK which is SAS session (process) specific and no other process (like another SAS session) gets access to this WORK directory.
Another thing that can keep a file handle open is anti-virus software which immediately scans all newly created files and prevents an overwrite (or even opens exclusively).
Save $250 on SAS Innovate and get a free advance copy of the new SAS For Dummies book! Use the code "SASforDummies" to register. Don't miss out, May 6-9, in Orlando, Florida.
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.
Ready to level-up your skills? Choose your own adventure.