Hi. I'm reading that SAS Libnames cannot be any longer than 8 characters. This is a horrible limitation for me as I need to assign multiple libnames (ten or more) of which 4 characters are an ID assigned specifically to me (because we are in a shared server environment). So this only leaves me only 4 chars to make my library names unique. I could use some numbering system like: myid_01, myid_02, myid_03, etc..., but this isn't intuitive and seems really ridiculous to me. When browsing my libraries that appear in the data explorer GUI window I really need to be able to clearly know which library belongs to which sas programming project I'm working on.
Is there anything I can do about this? Can I assign a label to a library name so that when it's displayed in the GUI data explorer I can see a more meaningful name that isn't restricted to just 8 characters? Any other suggestions?
Eight beith the count.
You might ask "management" how they decided that 4 characters were needed to id users. The first 4 characters would represent up to 1,367,631 users. Perhaps 2 (which would ID 999 users) or 3 (6,963 users) would help ease your problem.
I would suggest NOT using a _ as the separator because it contains no information and would not help by using 25% of your useable space to contain information.
Which GUI are you using?
I played a little with Enterprise Guide 7.15 and in the Open window for opening a dataset you can get a list of the LIBNAMES open in your server. It does have a detailed view. For some reason it does not show the path, but it does show a description and location fields. Not clear to me how one goes about putting information into either of those fields.
I guess the description is taken from SAS metadata.
Note sure how being on a shared server has any impact on the librefs you choose to use in your code. Two separate processes can use the same libref to point to different places (WORK is an obvious example), or use two different librefs to point to the same location.
I have a solution for you but you'll need to type the long names in your code:
%let my_first_library = XXXX1111;
%let my_next_library = XXXX1112;
%let my_third_library = XXXX1113;
libname &my_first_library "...path1...";
libname &my_next_library "...path2...";
libname &my_third_library "...path3...";
data &my_third_library..new_data;
set &my_first_library..old_data;
.....
run;
You don't need to do that. Since each user's SAS session only sees "their" library assignments, coding the user name into libnames is not necessary. If you need to temporarily access another user's libraries, a simple one-letter prefix would do to separate them from yours.
And you won't access 10000 libraries of 10000 users in a single session.
Probably stating the obvious but that is one of the dumbest client policies I've ever hear of. If these SAS libraries are shared between users then having every user define them differently is even dumber.
The limitation of 8 characters is for the libref. If you define the libraries in SAS Metadata then SAS EG or SAS Studio will show you the metadata name ("the label") and not the libref. The metadata name can be longer than 8 characters.
Not done in above picture but something I consider good practice: Also add the libref to the SAS Metadata name. To directly see the libref makes a coders live easier. I.e. for the first library that could look like:
00_Control (ctrl00) ....with ctrl00 being the libref.
@Patrick Thanks so much. So how do I define the libraries in SAS Metadata? Is this done as part of defining the libname statement or some other way?
For example: I have this libname statement currently:
libname LGTEBA "/sasdata/users/blxn/LabGeneTestExcessBillAn/Datasets";
As such I see "LGTEBA" in SAS EG's data explorer GUI: I'd much rather see it appear in SAS EG's data explorer GUI as "LGTEBA_LabGeneTestExcessBillAn_ds".
I've tried this, but it's obviously not working as I don't understand how to define something in the metadata. I guess I need help with the syntax.
libname blxn "/sasdata/users/&sysuserid./LabGeneTestExcessBillAn/Datasets";
libname blxn meta library="LabGeneTestExcessBillAn_Ds" metaout=data;
142 libname &sysuserid._lib meta library="LabGeneTestExcessBillAn_Ds" metaout=data;
ERROR: No metadata objects found matching the specified URI.
ERROR: Error in the LIBNAME statement.
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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.