The SAS Output Delivery System and reporting techniques

Spanned header autofit row

Posts: 67

Spanned header autofit row

Hi All,


I am facing issue while i am using spanned header and the values are not being displayed properly in Row.


I need to manually increase the height of spanned header row.


Here is the sample code.


ods Tagsets.ExcelXP style=sasweb
options(orientation='landscape' sheet_name="Table_2b" embedded_titles='yes' embedded_footnotes='yes' autofit_height='yes' ); 
proc report data=Out.Table_2b split='*' headskip spanrows spacing=0 nowd style(header)=[fontweight=bold ];
column sr_no param ("Cohort 1 - 0.3 mg/kg *  N=%trim(&_C103)" C103 C103_DY) ;
define sr_no/noprint order=data;
define param /Display width=60 center "End of Study Reason* (include Other and specify)"
	              style(header)=[just=center] style(column)=[cellwidth=200 just=center];
define C103 /Display width=60 center "Number of Subjects* n (%)"
	              style(header)=[just=center] style(column)=[cellwidth=100 just=center];
define C103_DY /Display width=60 center "End of Study Day* Median (Range)"
	              style(header)=[just=center] style(column)=[cellwidth=100 just=center];

 I am attaching the screenshot of issue.


Please guide .




Super User
Super User
Posts: 9,789

Re: Spanned header autofit row

Posts: 67

Re: Spanned header autofit row



But didnt solve the issue.


For me it is only with spanned header where i used split option * and values not being visible fully by default.

Super User
Super User
Posts: 9,789

Re: Spanned header autofit row

Well, it could just be an Excel render issue.  Excel is really pretty bad for any purpose, I have it in my grids where it resizes incorrectly, or runs things off the page when too many characters etc.  Hence why I wouldn't use it for anything.  What does it show if you remove the split?  Can you just add some more spaces to get it wrap correctly?

Posts: 9,423

Re: Spanned header autofit row

[ Edited ]



  I don't understand how your code produced the screen shot you sent. Your screen shot shows the last line with a yellow background and that's not part of SASWEB style.


And I think you are trying to over-control the widths. WIDTH=60 is a LISTING only specification and then you confuse it with a CELLWIDTH for ODS. Also, your use of STYLE overrides is inconsistent with your use of SPACING= and HEADSKIP, which are LISTING only options.



You didn't send ALL your code -- there's no FILE= in your ODS statement and no ODS TAGSETS.EXCELXP CLOSE; I'm not sure you need the autofit for the row heights if you fix every thing else. Since you didn't provide any data or all your code (for the macro variables, etc), I just made some variables and set a value for the macro variable.

First, simplifying your code, I got this:

And the width seems a bit off, but otherwise, the autofit for row heights doesn't seem to be needed.

Then, adding cellwidth back in but using a unit of measure, I got this:


In your original screen shot you showed the headers wrapping at a place other than the * and I think that happened because you had conflicting widths that were ultimately too small for the string that needed to fit in the width.


Posts: 67

Re: Spanned header autofit row

Posted in reply to Cynthia_sas

Hi Cynthia,


This works perfect.


Thanks to point out issues in code.


I will enhance the code for rest of the tables i am including in my report.

Ask a Question
Discussion stats
  • 5 replies
  • 3 in conversation