BookmarkSubscribeRSS Feed
Niugg2010
Obsidian | Level 7

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;

5 REPLIES 5
ballardw
Super User

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.

 

Niugg2010
Obsidian | Level 7

TOTALFR is on the second page 5th column. 

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

ballardw
Super User

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.

 

Cynthia_sas
Diamond | Level 26
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
Niugg2010
Obsidian | Level 7

Thanks.

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 5 replies
  • 5107 views
  • 0 likes
  • 3 in conversation