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;
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.
TOTALFR is on the second page 5th column.
I transfered it into Doc, because I can not upload rtf file.
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.
Thanks.
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.
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.