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
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.
@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.
I am outputting to PDF.
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.
This worked! Thank you!!!
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
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.