BookmarkSubscribeRSS Feed
coladuck
Fluorite | Level 6

Hi,

 

I have a question on sheet name been truncated in ODS EXCEL output. I saw the ODS Sheet_name has a limitation of 28 characters but Excel sheet name allow more. For example, if I use proc export, the sheet name will output fine. But because the percentage format is not kept in proc export, I had to rely on ODS EXCEL. 

 

Is there a way to get around it, meaning keeping the full sheet name? 

 

Here is my simple code: 

ods excel file=&outputexcel; 
ods excel options(sheet_label = "XXXXXXXXX Tracking Data Summary"); run; 
proc report data=mydata;
run;
ods excel close;

 and the output Excel Tab will be "XXXXXXXXX Tracking Data Summ"

Thanks in advance!!

3 REPLIES 3
Kurt_Bremser
Super User

sheet_label and sheet_name are concatenated to build the final sheet name in the workbook (if you specify sheet_interval as "bygroup", the final sheet name will be built from sheet_label and the group value).

Together they are limited by the 28 character limit. The Excel GUI allows to enter 31 characters, while the Excel file format seems to allow 255, as I have found while researching this (Maxim 6: Google Is Your Friend).

Tom
Super User Tom
Super User

You might need to ask SAS technical support. 

I suspect it is losing the extra three characters because of some issue with the 'sheetname$'n syntax.

https://support.sas.com/kb/16/176.html

The quotes and dollar sign add up to the missing 3 characters.

Cynthia_sas
Diamond | Level 26

Hi: You are correct. Excel allows 31 characters. ODS EXCEL allows the sheet names to be 28 characters long because part of how ODS works is that if it needs to append a number to the end of your name, it needs to reserve some extra characters for numbering as shown below:

Cynthia_sas_0-1587255437954.png

Cynthia

Catch up on SAS Innovate 2026

Dive into keynotes, announcements and breakthroughs on demand.

Explore Now →
How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 6578 views
  • 2 likes
  • 4 in conversation