Hi, I have DB2 Database table with table definitions stating column names are over 32 characters in length. I understand dataset names or variable names cannot be more than 32 in SAS. However is there a work around? Labelling is one option, but that does not form a part of the data structure as I read a SAS dataset and populate into database table. Can anybody help?
No, you can not have dataset names longer than 32 bytes, even in 9.4:
SAS(R) 9.4 Language Reference: Concepts, Fourth Edition
So your only option is to set up consistent rules for converting overlong table names when importing into SAS.
A similar "rule" is in place here for column names. DB/2 columns that have a "#" at the end of their name have that converted to an underline in SAS
Thanks Kurt, Does that apply to variable names as well? or validvarname= any options may help?
validvarname=any just allows use of name literals ('xxyy zz#$'n), but does not extend the length. This is probably rooted in the inner structure of the dataset header page.
This issue comes up a lot. Even if SAS sticks with 32 character names for SAS datasets but enables reading of tables from other databases with longer names using other than SQL PASSTHRU would be an improvement.
Vote for this idea to encourage better solutions: https://communities.sas.com/ideas/3506
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.