BookmarkSubscribeRSS Feed
Neeta
Fluorite | Level 6

Hi,

I'm using ODS excel for printing multiple proc reports on single excel sheet. It appears that first table is deciding column width for all the tables. I'd like to customize column width for each table.

 

ods tagsets.excelxp file="C:\Users\XYZ\Desktop\try.xls" options(embedded_titles = 'yes' row_heights='20,35' width_points='1.5' sheet_interval = 'none' sheet_name = 'Class ');

title j=c bcolor=lightblue "Class - Age gender";

proc report data=sashelp.class headskip headline spacing=1 nofs split='|' missing
style(header)=[just=center ]
style(column)=[protectspecialchars=off asis=on just=center ] ;
column Name age sex;
define name / display style(column)=[cellwidth =200] "Subjid";
define age / display style(column)=[cellwidth =500] "age";
define sex / display style(column)=[cellwidth =200] "Sex";
run;

title j=c bcolor=lightblue "Class -Height Weight"; ;

proc report data=sashelp.class headskip headline spacing=1 nofs split='|' missing
style(header)=[just=center ]
style(column)=[protectspecialchars=off asis=on just=center ] ;
column Name height weight;
define name / display style(header)=[background=lightGray] style(column)=[cellwidth =200] "Subjid";
define height / display style(header)=[background=lightGray] style(column)=[cellwidth =200] "Height";
define weight / display style(header)=[background=lightGray] style(column)=[cellwidth =200] "Weight";

run;

ods tagsets.excelxp close;

 

 

Here, though I specified width of 200 for variable Height on second table but its taking width 500 from Age variable on first table.

1 REPLY 1
Reeza
Super User

That's sadly a limitation of Excel, a single column cannot have different widths so if happens to align it will take the widths from the table at the top. 

 

The usual way to 'workaround' this issue is to merge/collapse cells, but TAGSETS does not support that. 

 


@Neeta wrote:

Hi,

I'm using ODS excel for printing multiple proc reports on single excel sheet. It appears that first table is deciding column width for all the tables. I'd like to customize column width for each table.

 

ods tagsets.excelxp file="C:\Users\XYZ\Desktop\try.xls" options(embedded_titles = 'yes' row_heights='20,35' width_points='1.5' sheet_interval = 'none' sheet_name = 'Class ');

title j=c bcolor=lightblue "Class - Age gender";

proc report data=sashelp.class headskip headline spacing=1 nofs split='|' missing
style(header)=[just=center ]
style(column)=[protectspecialchars=off asis=on just=center ] ;
column Name age sex;
define name / display style(column)=[cellwidth =200] "Subjid";
define age / display style(column)=[cellwidth =500] "age";
define sex / display style(column)=[cellwidth =200] "Sex";
run;

title j=c bcolor=lightblue "Class -Height Weight"; ;

proc report data=sashelp.class headskip headline spacing=1 nofs split='|' missing
style(header)=[just=center ]
style(column)=[protectspecialchars=off asis=on just=center ] ;
column Name height weight;
define name / display style(header)=[background=lightGray] style(column)=[cellwidth =200] "Subjid";
define height / display style(header)=[background=lightGray] style(column)=[cellwidth =200] "Height";
define weight / display style(header)=[background=lightGray] style(column)=[cellwidth =200] "Weight";

run;

ods tagsets.excelxp close;

 

 

Here, though I specified width of 200 for variable Height on second table but its taking width 500 from Age variable on first table.


 

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 1494 views
  • 0 likes
  • 2 in conversation