Re: Variable Name Truncation

Do you know what the maximum length of a SAS variable name is? When you provide a 30 character variable and use autoname option to add enough characters to exceed that number of characters what should SAS do for a result?

This will be a problem with any fixed length limit of variable names though:

prod_INVT_OLD_BAL_AVG_ACT_1_3M

could be

ProdInvtOldBalAvgAct_1_3M

and save a few characters without losing information. Not that I want to type either of those very often.

Re: Variable Name Truncation

What do you want in the output: The complete long variable name or the full suffix for the statistics requested with the autoname option? With variables named prod_INVT_OLD_BAL_AVG_ACT_1_3M you can't have both.

You can get lists of the variables generated by proc means like this:

proc sql ;

select NAME into : QR separated by ' '

from dictionary.columns

where memname='TEMP' and Libname='WORK'

and index(upcase(NAME),'QRANGE')>0;

select NAME into : Q1 separated by ' '

from dictionary.columns

where memname='TEMP' and Libname='WORK'

and index(upcase(NAME),'P25')>0;

select NAME into : Q3 separated by ' '

from dictionary.columns

where memname='TEMP' and Libname='WORK'

and index(upcase(NAME),'P75')>0;

quit;

Assuming none of the variables have the key words QRANGE, P25 or P75 as part of their names.

Re: Variable Name Truncation

Thank you so much. It's a nice code but it will be very heavy as my dataset consists of 1 million observations and 1K variables. But i learnt a lot of tricks from your code. Yes, i have copied code from that site. I have written an email to the author regd issues you highlighted just above. God bless you! :-)