The SAS Output Delivery System and reporting techniques

ODS PDF Title statement

Reply
Contributor
Posts: 48

ODS PDF Title statement

I have an image in my title statement but can't contain it to the first page. 

 

I have tried to clear it with title; but didn't work.

 

Any comments/advice is much appreciated:

 

title j=l '^S={preimage="H:\*.png"}'
j=c 'xxxxxxxxxxxxxxxxxxxx'
j=c "  &StartDate. to &EndDate.";

HabAM
Super User
Posts: 24,026

Re: ODS PDF Title statement

I have tried to clear it with title; but didn't work.

What does that mean?

 

Is the image too big to fit on one page or is it appearing on multiple pages even though it's small enough to fit on one page. If it's too big you'll need to resize it first.

SAS Super FREQ
Posts: 9,434

Re: ODS PDF Title statement

[ Edited ]

Hi:
I am not sure that *.png is a valid file name. Can you show a picture of what you mean when you say "you cannot contain it to the first page"?

A SAS TITLE statement is global. So if your procedure output produces multiple pages of output, then the TITLE statement would be in effect for the entire procedure and would appear on multiple pages. You cannot "clear" a title page in the middle of a procedure. You did not show any other code except for the title statement and I wonder whether you have a multi-page PDF output and you only want the preimage on page 1.

cynthia

 

Since I don't know what SAS Options or ODS PDF options you have in place, I just ran a little test using SASHELP.SHOES. I don't have an image on this machine to use, but I put a placeholder in the code. Right now, in this type of multi-page output, you cannot "reset" the title between pages. You can only reset the title between procedure steps.

%let startdate = 01jan2018;
%let enddate = 15feb2018;
 
ods pdf file='c:\temp\test_title.pdf';
title j=l 'preimage here'
      j=c 'xxxxxxxxxxxxxxxxxxxx'
      j=c "  &StartDate. to &EndDate.";
 
proc print data=sashelp.shoes(obs=100);
run;
ods pdf close;

Or else, you have to do something like display the first 35 observations on page 1 with the preimage and then display the rest of the observations after resetting the title. Something like this:


%let startdate = 01jan2018;
%let enddate = 15feb2018;
 
ods pdf file='c:\temp\alt_title.pdf';
title j=l 'preimage here'
      j=c 'xxxxxxxxxxxxxxxxxxxx'
      j=c "  &StartDate. to &EndDate.";
 
proc print data=sashelp.shoes(obs=35);
run;

title 'New Title starts on page 2';
proc print data=sashelp.shoes(firstobs=36 obs=100);
run;
ods pdf close;

(you might have to fiddle with the obs= and firstobs= depending on your margin settings. My page got approx 35 obs per page using PROC PRINT.

Contributor
Posts: 48

Re: ODS PDF Title statement

Posted in reply to Cynthia_sas

 

 

Here is part of the code I use. Its not that the image is large or small, it places the same image on the next page and still outputs my SGPLOT graph on top of the image. see image attached ..

 

 

ods listing close;
option nodate nonumber;
ODS PDF file="H:\* &dt..pdf" style=color
STARTPAGE=NEVER;
ODS escapechar="^";

title j=l '^S={preimage="H:\*.png"}'
j=c 'xxxxxxxxxxxx'
j=c " &StartDate. to &EndDate.";

ods layout start height=2.2in width=8in ;
options orientation=portrait
papersize = letter
topmargin=.5in bottommargin=.25in
leftmargin=.25in rightmargin=.25in;
ODS noproctitle;


ODS REGION ;
ODS PDF text="^S={just=l font_size=12pt font_weight=bold font_face=Arial}Summary:";
ODS PDF text="^S={width=100% just=J font_size=12pt font_face=Arial }&summary.";
ods layout end;
ods layout gridded columns=2 column_widths=(50% 50%) column_gutter=.25in ;
ODS REGION x=0in ;
ods graphics on / reset noborder height=3.5in;

 

PROC REPORT DATA = age nowd style(header)=[foreground=white background=steel font_weight=bold];
.......
title1 "^S={just=l font_size=10pt font_face=Arial font_weight=bold}Table 1: xxxxxx ( &WeekFrom., &YearFrom to Week &WeekTo., &YearTo)";
run;

 

.....

Multiple proc statements

.....

ODS Layout end;


ods pdf close;

HabAM
SAS Super FREQ
Posts: 9,434

Re: ODS PDF Title statement

Hi: You have a preview of Excel but your code is ODS PDF with ODS LAYOUT and ODS REGION statements. For help debugging ODS PDF with ODS LAYOUT and ODS REGION, your best resource might be to open a track with Tech Support. ODS LAYOUT and ODS REGION are only supported by ODS PDF and ODS HTML, so I do not believe they will work with ODS EXCEL.

cynthia
Contributor
Posts: 48

Re: ODS PDF Title statement

[ Edited ]
Posted in reply to Cynthia_sas

I did a screenshot. Please see the actual output.

HabAM
SAS Super FREQ
Posts: 9,434

Re: ODS PDF Title statement

Hi:
Again, you don't show all your code, nor explain what is INSIDE your PROC REPORT, nor what code is putting the figures on the page. If you have a procedure step for every figure or every 2 figures, then you should be able to reset the title statement:
title;
between the procedure that does Figure 2 at the end of page 1 and the procedure that does Figure 3 and 4 at the top of page 2.

Otherwise, I suggestion working with Tech Support, as they can look at ALL your code and make a more constructive suggestion.

cynthia
Contributor
Posts: 48

Re: ODS PDF Title statement

Posted in reply to Cynthia_sas
Thank you Cynthia
HabAM
Ask a Question
Discussion stats
  • 7 replies
  • 212 views
  • 0 likes
  • 3 in conversation