The SAS Output Delivery System and reporting techniques

ods rtf column width question

Reply
Contributor
Posts: 66

ods rtf column width question

[ Edited ]

Below is my code, I want to control output  column width.  For totalFR variable, why the define does not work and its column is not 0.75in? How can I deal with this issue without changing outputwidth=7 and other four columns definions?  In the attachment, totalFR variable is on the second page and fifth column.

 

options orientation=portrait nonumber center ls=256;
ods rtf file="C:\Users\user\Desktop\111.rtf";
proc report data=sashelp.Demographics(obs=20) nowd
style(report)=[outputwidth=7 in]
style(header)=[background=white font_size=10pt];
column _all_;
define CONT/ id style=[cellwidth=0.75in];
define ID /id style=[cellwidth=0.75in];
define ISO /id style=[cellwidth=0.75in];
define NAME / id style=[cellwidth=0.75in];
define totalFR / style=[cellwidth=0.75in];
run;
ods rtf close;

Grand Advisor
Posts: 10,235

Re: ods rtf column width question

Since you do not explicitly list all of the variables in your proc report we have to guess which column is your TOTALFR variable in the output and on which page. It appears that your code may be incomplete

 

Also why bother converting the file to DOC? The conversion could introduce changes.

 

Contributor
Posts: 66

Re: ods rtf column width question

TOTALFR is on the second page 5th column. 

I transfered it into Doc, because I can not upload rtf file. 

Grand Advisor
Posts: 10,235

Re: ods rtf column width question

I don't use proc report much but testing your code with options it may be an interaction with header and your define statements. Also the style does make a difference. For instance with style=meadow (using SAS 9.2) that column comes out wider than the surrounding ones. I do note that the skinny column happens to be the middle one so it may be something in the justification routine that Proc Report uses for too wide data. Note that ODS output ignores LS option. You might investigate the PAPERSIZE option to get different widths to display to along with changes of style and/or font sizes everywhere. It would depend on what you were attempting to achieve with the LS setting.

 

If the goal was to get all of the columns the same width then this worked.

proc report data=sashelp.Demographics(obs=20) nowd
style(report)=[outputwidth=7 in]
style(header)=[background=white font_size=10pt cellwidth=0.75in]
style(column)=[ cellwidth=0.75in]
;
column _all_;
/*define CONT/ id style=[cellwidth=0.75in];*/
/*define ID /id style=[cellwidth=0.75in];*/
/*define ISO /id style=[cellwidth=0.75in];*/
/*define NAME / id style=[cellwidth=0.75in];*/
/*define totalFR /  style=[cellwidth=0.75in];*/
run;

A brief test shows that you can use overrides to set specific column widths to different than 0.75.

 

SAS Super FREQ
Posts: 8,721

Re: ods rtf column width question

Hi:
Generally, I find it troublesome to "over control" the widths, essentially, either set your outputwidth for the whole report and let PROC REPORT and the destination handle the column sizes, or take full control and set your column sizes on each define, making sure that you don't specify values that add up to more than the the papersize minus the margins (left and right).

There are some good recommendations about wide output in PDF in this paper: https://support.sas.com/resources/papers/proceedings14/SAS038-2014.pdf and there's a section about what if my output is too wide, starting on page 12 that may be informative, even if your destination is RTF.

cynthia
Contributor
Posts: 66

Re: ods rtf column width question

Thanks.

Ask a Question
Discussion stats
  • 5 replies
  • 283 views
  • 0 likes
  • 3 in conversation