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?
Thank you for the response
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?
Thanks! That was helpful
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.
Thanks!
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.
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!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.