BookmarkSubscribeRSS Feed
Elise5783
Calcite | Level 5

Hi!  

 

I am doing a pdf output with several proc print statements.  I want to print some of the outputs on the same page with a title included for each output.  Is this possible?  I tried using an ods pdf text statement, but that did not work because it would display even if that specific output did not print.  I am doing this in a macro that creates a different report for each organization displaying their site specific data, so some of the reports don't apply to every site.  

 

For example, allowing all of the statements below to fit on a page (if space permits) with a different title for each proc statement:

 

proc freq data=visit2 order=data;
where siteid=&site.;
by phase;
tables visit /nocum;
format phase phase.;
run;

 

proc print data=visit2 label noobs;
where visit="M12" & siteid=&site.;
var usubjid;
run;

proc print data=m12vis2 label noobs;
where visit="M12" & siteid=&site.;
var usubjid mo15s;
label mo15s="Start of M15 visit window";
run;

 

Thanks in advance!

K

8 REPLIES 8
ravig
Obsidian | Level 7
Thanks for the question. TO clarifiy do you want to start each output in a different page ? Please give more details
ravig
Obsidian | Level 7
ods pdf ;

ods rtf startpage=now;

proc print data=SASHELP.CLASS;
title "CLASS DATASET OUTPUT";
run;


ods rtf startpage=now;

proc print data=SASHELP.CARS;
title "CARS DATASET OUTPUT";
where make="Acura";
var make model type;
run;

ods pdf close;
Elise5783
Calcite | Level 5

No, I would like to display all of the outputs on one page, if they will fit.  I am not attempting to force them to one page, but for them to print based on the available space.  I would like each to print with a title as well, so there would be more than one title on each page.  When I attempt to run the code it only prints the first title. 

ballardw
Super User

@Elise5783 wrote:

No, I would like to display all of the outputs on one page, if they will fit.  I am not attempting to force them to one page, but for them to print based on the available space.  I would like each to print with a title as well, so there would be more than one title on each page.  When I attempt to run the code it only prints the first title. 


Which ODS destination are you sending the output to? The options vary. For ODS RTF you likely are looking for options BODYTITLE and STARTPAGE=NO.

 

BODYTITLE says to place the titles in the body of the document, not the header which results in a single title but will span pages when needed.

ballardw
Super User

I don't use PDF much but there does seem to be a significant issue with "title" statements.  One possible workaround:

 

ods pdf file='X:\data\junk.pdf'
   startpage=never;

title 'Title the first';
proc print data=sashelp.class (obs=8);
run;

Proc odstext;
p "Faking a second title" /style=[fontweight=bold fontsize=12pt];
;
run;
proc print data=sashelp.class (firstobs=9);
run;
title;
ods pdf close;

Proc odstext is, in my opinion, a bit easier to set desired style elements than ODS Text="something";

You may need to play around with your style to get the fonts to appear similar, unless you want them different. Note that table of contents aren't going to be the same as with titles.

Elise5783
Calcite | Level 5

I initially thought the coding fixed the issue, but this displays that title even when the report does not print.  So in some cases, there is a title and no data table underneath it. 

 

Thanks,

Kia

 

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 8 replies
  • 4668 views
  • 0 likes
  • 3 in conversation