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
1. How is library LIB defined?
2. The code does not match the message. There is no table LIB.X in your code.
Its just an example I have it there for library name mylib
Thanks
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.
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.
LIB is a probably a non-SAS library. As there is no reply we'll never know...
The OP was edited, and the libname seems to point to a UNC network share.
@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.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.