BookmarkSubscribeRSS Feed
There is a bug in SAS that aggressively limits the length of variable names and cripples SAS's ability to interface with any well maintained literally name database.
54 Comments
RW9
Diamond | Level 26
Diamond | Level 26

Sorry, could you give examples of where you would want to use a variable name of 128 characters, or how programming with that would be beneficial?  A simple keep= statement could end up taking a whole page just keep a few variabels.  Remember we used to be limited to 8 characters and worked fine with that for many years, the expansion to 32 characters is both a benefit and a downside.  Personally if I have variables longer than 32 characters, or had to work with data like that I would be very unhappy.  I have yet to see a production database which has variable names longer than 32 as well.  Personally I would be quite happy if they restricted it back to 16.

Kurt_Bremser
Super User

Why not go the whole way in making code unreadable and increase it to 64k?

 

A length limit of 32 is not a bug, in my eyes it's a wonderful feature keeping the smaller minds from cluttering themselves and making living harder for the rest of us.

 

For descriptions, the labels can be used.

alecwh22
Fluorite | Level 6
All I want is for it to match up with that of modern style software like Teradata, SQL server and so on. In my opinion a good column name should state what's in it and the 32 limit often leads to contractions and abbreviations. I agree there should be a limit but I think 32 is too small and 64k is too big. If they were to make this change then it would still be possibly for you to have shorter variable names of 8 characters so I'm not entirely sure why I'm getting the trolling attitude.

Also I don't like the argument that 'people coped before, therefore it's OK now'; it's aggressively anti-progression.
user24feb
Barite | Level 11

You could use explicit pass through to rename your variables and make them fit.

 

http://www.mwsug.org/proceedings/2014/SA/MWSUG-2014-SA03.pdf

 

.. I added the example for ODBC, because I am using it.

alecwh22
Fluorite | Level 6
Thank you for a helpful response rather than just trolling.

That's what I have had to do but fundamentally it's a workaround of a SAS limitation and the more I deal with SAS the more I find there is a "deal with it" attitude. They can do that as they are huge and people don't want to use anything else but as a user; the more I learn the more I feel taken for granted. Hence posting this hoping to spark some change.
ChrisHemedinger
Community Manager

I appreciate the discussion raised by @alecwh22.  The 32-byte limitation on a variable name does rear up often -- mostly as SAS users are trying to interface with database tables that have long column names.  There are a number of strategies to work around (PRESERVE_COL_NAMES, passthrough, and newer programming languages in SAS like DS2 and FedSQL) -- these are worth exploring if you need an approach that works today.

 

I agree with others that long column names (even in databases) present a programming and maintenance challenge in general, but often SAS programmers are consumers of the database, and not the designers.

Kurt_Bremser
Super User

"There is a bug in SAS that aggressively limits the length of variable names and cripples SAS's ability to interface with any well maintained literally name database. "

 

And then the troll comes and accuses others of trolling.

 

ChrisHemedinger
Community Manager

Hi @Kurt_Bremser, I think we're all on the same page here now.  This conversation began on Twitter and I'm glad to have it here instead, as there is more room for thoughtful sharing and debate.  "bug" or "limitation" is semantics, and as a SAS developer I use the term "limitation" or even "as designed" -- but I can appreciate when something doesn't seem to work as a user needs it, and the perception that it's something that needs to be addressed.

RW9
Diamond | Level 26
Diamond | Level 26

Can I suggest that this is kept as a system option.  I am just searching the languages I know and not one of them recommends having long variable names.  My concern is that if the length is lengthed we will see programs which are vastly over sized with variable names such as:

the_age_of_subject_at_visit_one_with_missing_value_imputed_with_01_and_missing_month_imputed_as_january_for_purpose_of_creating_adsl

This doesn't add anything to the programming, and should be held in the label property of the variable.

I can give several posts from the Communities on this kind of topic now, the missunderstanding of variable name and label, even with the increase from 8 to 32 we are starting to see a rise of descriptive names, and no label, which makes programming a fair bit harder.  

alecwh22
Fluorite | Level 6
@Kurt_Bremser I used the term "aggressively" as 32 is only 25% of the length of the column name width of most DB tools and I thought the size of the relative disparity warented the term; what's your reasoning having attitude issue?

@ChrisHemedinger and @RW9 I agree this is a subjective issue and that a line has to be drawn some where, I would just like to put foreward my argument for altetering it and my argument is consistency. Beyond that I think people would be smart enough to know that loger variable names without a good reason isn't a good idea.