BookmarkSubscribeRSS Feed
usanj
Calcite | Level 5

Hi,

 

I am trying to generate both RTF and PDF output using the same PROC REPORT. It works fine for RTF & PDF when I don't assign any cell widths in define statement. But I see a break line in the row over the column headers for the column which has the cell widths assigned.  Below is the sample code. No issues in _car2* but I see the break line in _car1.pdf output. Any suggestions to fix this to allow the cell width control of any column without the break line causing the issue?

 


ods path work.temp(update) sashelp.tmplmst(read) sasuser.templat(update);

options leftmargin=0.75in rightmargin=0.75in topmargin=0.75in bottommargin=0.75in;

options orientation=landscape;

proc template;
define style cstyle;
parent=styles.Printer;
style Table /
foreground=black
background=white
cellspacing=0
cellpadding=0
frame=hsides
rules=groups
;
style Body /
foreground=black
background=white
;
style SysTitleAndFooterContainer /
cellspacing=0
;
end;
run;

 

 

ods rtf file="/outputs/_cars1.rtf" startpage=yes style=cstyle;
ods pdf file="/outputs/_cars1.pdf" startpage=yes style=cstyle;

proc report data=sashelp.cars nowd style(report)={just=left outputwidth=100%};
column ( make model type origin drivetrain);
define make / style(column)={just=left cellwidth=10%};
run;

ods _all_ close;


ods rtf file="/outputs/_cars2.rtf" startpage=yes style=cstyle;
ods pdf file="/outputs/_cars2.pdf" startpage=yes style=cstyle;

proc report data=sashelp.cars nowd style(report)={just=left outputwidth=100%};
column ( make model type origin drivetrain);
define make / style(column)={just=left };
run;

ods _all_ close;

 

Thanks

 

3 REPLIES 3
Kathryn_SAS
SAS Employee

Instead of using OUTPUTWIDTH, define a CELLWIDTH for each column.

ods _all_ close;
ods rtf file="_cars1.rtf" startpage=yes style=cstyle;
ods pdf file="c_cars1.pdf" startpage=yes style=cstyle;

proc report data=sashelp.cars nowd style(report)={just=left};
column ( make model type origin drivetrain);
define make / style(column)={just=left cellwidth=1in};
define model / style(column)=[cellwidth=2in];
define type / style(column)=[cellwidth=2in];
define origin  /style(column)=[cellwidth=2in];
define drivetrain / style(column)=[cellwidth=1in];
run;

ods _all_ close;
usanj
Calcite | Level 5

Hi Kathryn - with above suggested code, only 3 columns show up Page 1 and next 2 are getting pushed to next page.  My intention is to make the page wide (minus the margins) and fit in as many columns as possible.

Kathryn_SAS
SAS Employee

You may have to use trial and error to determine the best Cellwidths based on orientation and margin settings. You will not be able to use OUTPUTWIDTH if you do not want a break in the header border in the PDF output.

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
  • 3 replies
  • 342 views
  • 0 likes
  • 2 in conversation