BookmarkSubscribeRSS Feed
buechler66
Barite | Level 11

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?

15 REPLIES 15
ballardw
Super User

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.

 

 

buechler66
Barite | Level 11
Understood, but I will not be able to change the policy of a 4 char
username as this is our client's policy.

So, I'm am I hearing their is no way to assign a label to the LIBNAME? It
just seems so 'stone age' to have an 8 char limitation in a visual GUI
environment.

Very frustrating. Even variable names allow for 32 chars, right? Grrr...
Tom
Super User Tom
Super User

Which GUI are you using?  

image.png

buechler66
Barite | Level 11
In this case I'm in SAS Enterprise Guide.
Tom
Super User Tom
Super User

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.

 

image.png

Tom
Super User Tom
Super User

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.

buechler66
Barite | Level 11
Good point. Yet still, 8 chars leaves me no room for a meaningful library
description. At best I could make up acronyms, but even that will end up
being confusing in the long run. Ho hum...
Shmuel
Garnet | Level 18

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;
Kurt_Bremser
Super User

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.

SASKiwi
PROC Star

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.

buechler66
Barite | Level 11
Agreed. Thank you for the clarification. However the real core of my question is whether there's a way to see a longer Libname label that is longer than 8 chars.
Patrick
Opal | Level 21

@buechler66 

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.

Capture.JPG

 

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.

buechler66
Barite | Level 11

@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.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

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
  • 15 replies
  • 5259 views
  • 5 likes
  • 7 in conversation