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-2024.png

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.

 

Register 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.

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
  • 1378 views
  • 0 likes
  • 2 in conversation