BookmarkSubscribeRSS Feed
Paige
Quartz | Level 8
I am creating an Excel file with Tagsets.Excelxp and PROC REPORT. I want to modify the row heights in the Excel file, make them smaller or larger.

I have played around with a number of option in the ods tagsets.excelxp statement and also with STYLE options (the height= option) in PROC REPORT, and haven't found the right method. Could someone give me an example using either ods tagsets.excelxp or STYLE=?

Thanks
5 REPLIES 5
Cynthia_sas
SAS Super FREQ
Hi:
I find that row heights are troublesome, no matter what method I use when I open the output file in Excel. Techniques that work perfectly well for HTML fail miserably in EXCEL when I use them with TAGSETS.EXCELXP. In addition the ROW_HEIGHT sub-option that is available with versions of TAGSETS.EXCELXP has NEVER worked for me.

Here's some code to test out -- compare the HTML output created by MSOFFICE2K for the browser with the XML/ExcelXP output created for Excel. As you see, none of the methods work. Excel is very "picky" about setting row heights and I just never bother with row heights. This may be a question for Tech Support -- if there is any kind of workaround, they would be able to find it out.

cynthia
[pre]
ods tagsets.excelxp file='c:\temp\rowheight1a.xls'
style=sasweb
options(doc="help");
ods msoffice2k file='c:\temp\rowheight1a_mso.html' style=sasweb;

proc report data=sashelp.class nowd;
title '1a) Use HEIGHT in CALL DEFINE';
title2 'HTML respected; EXCELXP ignored';
column name age height weight;
compute weight;
if name = 'John' then
call define(_row_,'style','style={height=100px}');
endcomp;
run;

ods _all_ close;

ods tagsets.excelxp file='c:\temp\rowheight1b.xls'
style=sasweb;
ods msoffice2k file='c:\temp\rowheight1b_mso.html' style=sasweb;

proc report data=sashelp.class nowd;
title '1b) Use HTMLSTYLE attribute';
title2 'HTML respected; EXCELXP ignored';
column name age height weight;
compute weight;
if name = 'John' then
call define(_row_,'style','style={htmlstyle="height:100px"}');
endcomp;
run;

ods _all_ close;

ods tagsets.excelxp file='c:\temp\rowheight2.xls'
style=sasweb;
ods msoffice2k file='c:\temp\rowheight2_mso.html' style=sasweb;

proc report data=sashelp.class nowd
style(column)={height=2in};
title '2) Use HEIGHT in PROC REPORT statement';
title2 'HTML respected; EXCELXP ignored';
column name age height weight;
run;

ods _all_ close;


ods tagsets.excelxp file='c:\temp\rowheight3.xls'
options(row_height='0,50,0,0,0,0,0')
style=sasweb;

proc report data=sashelp.class nowd;
title '3) Use ROW_HEIGHT sub-option for TAGSETS.EXCELXP (no HTML equiv)';
title2 'EXCELXP ignored';
column name age height weight;
run;

ods _all_ close;


ods tagsets.excelxp file='c:\temp\rowheight4.xls'
options(row_height='0,50,0,0,0,0,0')
style=sasweb;
ods msoffice2k file='c:\temp\rowheight4_mso.html' style=sasweb;
ods escapechar='~';

proc report data=sashelp.class nowd;
title '4) Now add some some newlines (line feeds) to the data';
title2 'HTML respected; EXCELXP ignored (have to widen column to see values)';
column name prtname age height weight;
define name / noprint;
define prtname / computed;
compute prtname / character length=20;
prtname = catx(' ',name,'~1n','~1n','~1n');
endcomp;
run;

ods _all_ close;


data class;
set sashelp.class(obs=3);
length longvar $150;
longvar='Twas brillig and the slithy toves did gyre and gimble in the wabe.'||
' All mimsy were the borogroves and the mome raths outgrabe.';
run;

ods tagsets.excelxp file='c:\temp\rowheight5.xls'
style=sasweb;
ods msoffice2k file='c:\temp\rowheight5_mso.html' style=sasweb;
ods escapechar='~';

proc report data=class nowd;
title '5) Use cellwidth with a LONG text variable';
title2 'HTML respected; EXCELXP ignored (have to widen column to long string)';
column longvar name age height weight;
define longvar / display style(column)={cellwidth=1.25in};
run;

ods _all_ close;
[/pre]
Peter_C
Rhodochrosite | Level 12
Cynthia
instead of [pre] options(row_height='0,50,0,0,0,0,0')[/pre]try:[pre] options(row_heightS='0,50,0,0,0,0,0')[/pre]
just a thought this suggestion relates to excelXP Message was edited by: Peter.C
Cynthia_sas
SAS Super FREQ
My bad. It did work for that simple example!
Thanks for the catch.
cynthia
boschy
Fluorite | Level 6
Row heights are a nightmare. We're using a modified version of the tagset that fixes various problems like this. The end result is print-ready Excel output (using XML in the background) that has frozen headers, page numbers, run dates, footers, etc.

I set the AUTOFIT_HEIGHT option to 'yes' to exand rows and force text to wrap. However, I believe that this does not work in the standard tagset. It has been a few years.

-Bosch-
boschy
Fluorite | Level 6
I should say we're using and modified version of:

Excel XP tagset (SAS 9.1.3, v1.70, 06/05/07).

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
  • 5 replies
  • 7951 views
  • 1 like
  • 4 in conversation