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.";
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.
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.
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;
I did a screenshot. Please see the actual output.
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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.