Data visualization with SAS programming

Overall Title for multiple SGPLOT graphs

Reply
New Contributor
Posts: 4

Overall Title for multiple SGPLOT graphs

HI everyone,


I managed to plot 4 sgplot graphs on a single pdf using ODS, as shown below.

But I would also like to provide an overall title for the 4 graphs.

My attempts using proc gslide were unsuccessfull, as the title from proc gslide is just being repeated for all the graphs


Does anyone have an alternative idea how to set an overall title, while at the same time use separate titles for the graphs ?


Thanks


--


data sample; var=1; run;


proc gslide;

 title "Overall Title" ;

run;



options orientation = landscape;


ods graphics on / width = 5in height = 3in;


ods pdf file="C:\pdf.pdf" columns=2 startpage=never;



proc sgplot data = sample;

 vbar var;

run;


proc sgplot data = sample;

 vbar var;

run;


ods pdf startpage=now;


proc sgplot data = sample;

 vbar var;

run;


proc sgplot data = sample;

 vbar var;

run;



ods pdf close;

Grand Advisor
Posts: 9,699

Re: Overall Title for multiple SGPLOT graphs

Put a

Title "This is the title I want to appear on all graphs";

Before the first Proc sgplot statement;

You will want to place a

Title;

after the last Proc to clear the title from appearing on other procedure results later.

Occasional Contributor DDT
Occasional Contributor
Posts: 18

Re: Overall Title for multiple SGPLOT graphs

Thanks for this example of PDF columns and controlling PDF page breaks, to put multiple PROC SGPLOT or GTL outputs on the same PDF page.

 

This is a much better approach than the rather awkward solution that SAS offer in Sample 41461!!

SAS Super FREQ
Posts: 863

Re: Overall Title for multiple SGPLOT graphs

You can use the ODS TEXT option to create your own exterior title. Try this simple example:

 

ods _all_ close;
ods escapechar="~";
ods pdf file="temp.pdf" startpage=never;
ods text="~{style [just=center fontweight=bold fontsize=14pt] This is an OVERALL title}";
ods graphics / height=400px;
title "graph title 1";
proc sgplot data=sashelp.class;
vbar age;
run;
title "graph title 2";
proc sgplot data=sashelp.class;
vbar sex;
run;
ods _all_ close;
 

Post a Question
Discussion Stats
  • 3 replies
  • 580 views
  • 1 like
  • 4 in conversation