BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Jannie_D
Calcite | Level 5

I have problems running all codes I am trying to run. whatever code I run I get this error

 Error: library is not in a valid format for access method random

 

I have only datasets in SAS format. They used to work without this problem but now this appeared. the code that Im currently running is:

libname DTS ".....path..." ;

 

proc sort Data=DTS Out=DTSs;

by pnr;

run;

proc print data=DTSs;

run;

 

I cannot copy paste the log because it is on a secure server.

 

can anyone help me?

1 ACCEPTED SOLUTION

Accepted Solutions
SAS_Cares
SAS Employee

Editors Note:  The  link provided likely shows how to resolve the problem.  The libname statement is  assigning the libref to a data set rather than the directory containing the data set you want to use. The libname statement will succeed, but when you try to use that libref, you will see the error  "Library mylib is not a valid format for access method RANDOM".

 

 

Sorry about the link reference above and thanks for bringing this to our attention. We should have included this link https://communities.sas.com/t5/SAS-Programming/Format-of-libname-statement/td-p/297612

View solution in original post

4 REPLIES 4
mkeintz
PROC Star

I wonder if you are confusing libnames with dataset names.

 

The statements:

proc sort Data=DTS Out=DTSs;
  by pnr;
run;

will attempt to sort a dataset named work.dts (i.e. a dataset named DTS in the WORK library).   It will have nothing to do with any datasets you may have in the libname DTS.  Remember, the libname identifies a "container" which can contain multiple datasets, catalogs, and a few other sas "containee" types.

 

If there is a dataset named MYDATA inside the DTS library, you could

proc sort data=dts.mydata  out=mydatas;
  by pnr;
run;

which could create a dataset named MYDATAS inside the WORK library  (use  "out=dts.mydatas" to put the result in the DTS library).

 

So, are you actually trying to manage a dataset in libname DTS?  If so, your first task is to get the proper dataset name.  It could also be named dts, which means you will refer to it as  DTS.DTS.

 

Finally, if this program has been working before, it means you actually had a work.dts dataset.

--------------------------
The hash OUTPUT method will overwrite a SAS data set, but not append. That can be costly. Consider voting for Add a HASH object method which would append a hash object to an existing SAS data set

Would enabling PROC SORT to simultaneously output multiple datasets be useful? Then vote for
Allow PROC SORT to output multiple datasets

--------------------------
SAS_Cares
SAS Employee

Editors Note:  The  link provided likely shows how to resolve the problem.  The libname statement is  assigning the libref to a data set rather than the directory containing the data set you want to use. The libname statement will succeed, but when you try to use that libref, you will see the error  "Library mylib is not a valid format for access method RANDOM".

 

 

Sorry about the link reference above and thanks for bringing this to our attention. We should have included this link https://communities.sas.com/t5/SAS-Programming/Format-of-libname-statement/td-p/297612

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 4 replies
  • 15580 views
  • 1 like
  • 4 in conversation