Reputation: 2448
I am using SAS 9.3. My goal is to create a pdf file with 2 graphs on each page. I got partial success with this code:
data mydata;
var1=1;
var2=2;
run;
%macro pic;
%do i=1 %to 6;
proc sgplot data=mydata;
title "Title &i";
vbar var1 / response=var2;
run;
%end;
%mend pic;
ods pdf file = "&folder\test.pdf" STARTPAGE=NEVER style=SASweb;
%pic;
ods pdf close;
However, the problem is that after page 2, SAS decides to automatically use my graph title as a page title. The double title takes space and look stupid. How to get rid of this page title? Why it doesn't appear on the first page?
How do I keep the graph title but get rid of the page title?
Edit: I can fit two plots per page by resizing the graphs with this statement:
ods graphics on / width=580px;
But what I really need is to get rid of that double title.
I have tried to specify
title;
before the plot but it doesn't help. Also
Options noproctitle;
doesn't get me there.
Upvotes: 1
Views: 1660
Reputation: 63424
My suggestion is to take out the TITLE. Instead, use an INSET positioned on the top to give you the equivalent of a TITLE, inside the graph. (If you were using GTL, I'd suggest an EntryTitle
, but you're not.)
It's not exactly identical, but it gets the idea across. You can do better using GTL with ENTRYTITLE. You can also remove the frame around the axis with a style template (altering the wall borders, I believe).
data mydata;
var1=1;
var2=2;
run;
%macro pic;
%do i=1 %to 6;
proc sgplot data=mydata;
inset "Title &i";
vbar var1 / response=var2;
yaxis offsetmax=.1; *to leave some room for the inset;
run;
%end;
%mend;
ods pdf file = "&folder\test.pdf" STARTPAGE=NEVER style=SASweb;
%pic;
ods pdf close;
Upvotes: 1
Reputation: 168
Changing the title statement in your proc sgplot
to the below worked for me:
%if &i=1 %then %str(title "Title &i";);
%else %str(title;);
Hope that helps you.
Upvotes: 1