I understand the native character limit for variable names in SAS is 32. I would like to change it to 30.
Is there any easy way to do this?
The VALIDVARNAME option can enforce certain pre-defined standards. As you know, the max length is 32 bytes. There isn't an option to set this to 30.
@awesome_opossum wrote:
I understand the native character limit for variable names in SAS is 32. I would like to change it to 30.
Is there any easy way to do this?
No.
You can use the option VALIDVARNAME=V6 to force it to use 8 as the limit.
Why not just run your own tests to flag any variable with a longer name.
Perhaps something like:
proc sql;
create table longnames as
select libname,memname,name
from dictionary.columns
where length(name) > 30
;
quit;
@awesome_opossum wrote:
Thanks, this is a good answer. My concern is a matter of interfacing with a database that has a 30 limit and preventing issues with exchange between systems. It seems manually checking may be the only option, then, and that is an elegant approach.
If you just get in the habit of using reasonable variable names you should never come close to using names that are anywhere near 30 bytes long. You can use the LABEL feature of SAS to attach longer descriptions of the variables.
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.
Ready to level-up your skills? Choose your own adventure.