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

Hello programmers,

 

I am trying to wrap my head around libref and library.

Any help would be appreciated

Libname nsch "C:\Users\Aba\Box\NSCH\nsch1617combined_drc";
Libname library "C:\Users\Aba\Box\NSCH\nsch1617combined_drc";

PROC FORMAT LIBRARY=LIBRARY;
/*Topical*/

.The error message was that libref and library are the same physical address. Please in what formats should the libref and library be in? 

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User
It's fine, it's not an error, it's a warning or note I believe just to let you know that two definitions point t the same location. This means that anything written to nsch is also written to library so it's not a super useful thing to do in most cases.

View solution in original post

7 REPLIES 7
Reeza
Super User
It's fine, it's not an error, it's a warning or note I believe just to let you know that two definitions point t the same location. This means that anything written to nsch is also written to library so it's not a super useful thing to do in most cases.
ChuksManuel
Pyrite | Level 9

Thank you for the response

Krueger
Pyrite | Level 9

Libref is used to reference a library. 

 

In your code above nsch is useless as it is being overwritten by library why are they both pointed to the same Physical location?

ChuksManuel
Pyrite | Level 9

Thanks! That was helpful

FreelanceReinh
Jade | Level 19

Hello @ChuksManuel,

 

I wouldn't say it's useless to create the second libref because libref library has a special meaning when it comes to searching format catalogs (see FMTSEARCH= system option). It's not just an alias for nsch (in your case).

 

To avoid the note "... refers to the same physical library as ..." you can use this syntax

libname library (nsch);

referring to the existing libref nsch.

ChuksManuel
Pyrite | Level 9

Thanks!

Kurt_Bremser
Super User

Just to dig a little deeper into why one uses the special name "library": if you want to send data to other SAS users that contain custom formats, defining those formats in the catalog library.formats and storing the datasets in the same directory enables you to cport the whole library into one blob, and when the receivers also use "library" when they cimport the blob, the formats will automatically be there and usable.

 

Note that you should still send the format code along in a .sas file.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 7 replies
  • 2317 views
  • 10 likes
  • 5 in conversation