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
Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.
Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.
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.