BookmarkSubscribeRSS Feed
hexx18
Quartz | Level 8

Hi ,

 

I am running below query but I get an ERROR Lock not available . Can anyone please help .

 

 libname mylib  'serverY\DATA\TEST';

 

PROC SQL ;
CONNECT TO ODBC (DATAsrc=XXXX USER = XXX PASSWORD = XXX);
CREATE TABLE mylib.Apple AS
 SELECT * FROM CONNECTION TO ODBC
  (
Select account,
      member

from database.table d
);
quit;

NOTE : Table mylib.Apple created with 100 rows and 20 columns

data mylib.Apple;
SET mylib.Apple;
RUN;

ERROR: A lock is not available from mylib.Apple

 

Thank you

7 REPLIES 7
ChrisNZ
Tourmaline | Level 20

1. How is library LIB defined?

2. The code does not match the message. There is no table LIB.X in your code.

hexx18
Quartz | Level 8

Its just an example I have it there for library name mylib

 

 

Thanks

Kurt_Bremser
Super User

The engine and/or path used for your target library is crucial in determining the probable cause for your problem. But the momentary solution is to not overwrite the source dataset in one step, as I already mentioned, and this is also proper coding technique.

Kurt_Bremser
Super User

Steps like this:

data mylib.Apple;
SET mylib.Apple;
RUN;

are always dangerous in several aspects. Create a new dataset.

You might get a timing problem in your network share, so that it "thinks" the file is still open when SAS has in fact finished writing to it. Welcome to the world of Windoze.

ChrisNZ
Tourmaline | Level 20

LIB is a probably a non-SAS library. As there is no reply we'll never know...

ChrisNZ
Tourmaline | Level 20

@Kurt_Bremser It doesn't even look like a UNC path either.

It looks like a game of "I give incomplete information with typos and mismatches but please solve my problem".

 

@hexx18  As described, it's really weird and Kurt's explanation is plausible.

Or Maybe adding a disconnect would help?

If not, as a workaround and until a better solution is found, don't overwrite the table.

 

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 7 replies
  • 1537 views
  • 0 likes
  • 3 in conversation