Reputation: 1537
options orientation=portrait;
GOPTIONS device=ACTXIMG;
options nocenter nodate nonumber;
ods graphics / noborder width= 1200 height=360 scale;
ods pdf startpage=never file="\\...\aa.pdf";
title justify=center "t1";
proc sgplot
...
run;
title justify=center "t2";
proc sgplot
...
run;
ods pdf close;
I don't understand why when I put two graphs in the same page, the second title is missing in the pdf output.
If I put two graphs in two pages, then the second title appears. But I do need them in the same page.
It would be much better if it's possible to leave some blank rows between two graphs.
Ideal output:
title1
graph1
title2
graph2
What I have done:
title1
graph1
graph2
Upvotes: 0
Views: 1921
Reputation: 6378
Suggest adding GTITLE option to your ODS statement. This should tell SAS to put the title in your graph image, rather than the page header. I think GTITLE was added to ODS PDF in v9.3.
ods pdf file="d:\junk\want.pdf" startpage=never gtitle;
title1 "Some Title AAA";
proc sgplot data=sashelp.class;
scatter x=height y=weight;
run;
title1;
title1 "Some Title BBB";
proc sgplot data=sashelp.class;
scatter x=height y=weight;
run;
title1;
ods pdf close;
Upvotes: 2
Reputation: 1449
Reeza had the same problem some time back on sas communities. Cynthia (SAS) explained that titles go to the top of the page. Since you are forcing it to use the same by removing the page break, the second title doesn't appear. One way around it is to use ODS Text.
See the code below, it uses two new statement compared to your code. First line sets an escape char to be used in the second line for setting out the text block to be used instead of a title.
ods escapechar='^';
ods pdf text="^S={just=c} This is my interim title";
options orientation=portrait;
GOPTIONS device=ACTXIMG;
ods escapechar='^';
options nocenter nodate nonumber;
ods graphics / noborder width= 1200 height=360 scale;
ods pdf startpage=never file="/home/healthcarep/work/floss/aa.pdf";
title justify=center "t1";
proc sgplot data=sashelp.class;
scatter x=height y=weight / group=sex;
run;
title justify=center "t2";
ods pdf text="^S={just=c} This is my interim title";
proc sgplot data=sashelp.class;
scatter x=height y=weight / group=sex;
run;
ods pdf close;
It is a workaround, but it might meed your needs.
Regards, Vasilij
Upvotes: 2