How to name a dataset name that is more than 32 characters in length?

Reply
Contributor
Posts: 70

How to name a dataset name that is more than 32 characters in length?

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?

Esteemed Advisor
Posts: 6,646

Re: How to name a dataset name that is more than 32 characters in length?

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

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Contributor
Posts: 70

Re: How to name a dataset name that is more than 32 characters in length?

Thanks Kurt, Does that apply to variable names as well? or validvarname= any options may help?

Esteemed Advisor
Posts: 6,646

Re: How to name a dataset name that is more than 32 characters in length?

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.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Respected Advisor
Posts: 3,063

Re: How to name a dataset name that is more than 32 characters in length?

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

Ask a Question
Discussion stats
  • 4 replies
  • 1851 views
  • 0 likes
  • 3 in conversation