BookmarkSubscribeRSS Feed
kelloggs
Fluorite | Level 6

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;

3 REPLIES 3
ballardw
Super User

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.

DDT
Obsidian | Level 7 DDT
Obsidian | Level 7

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!!

DanH_sas
SAS Super FREQ

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;
 

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 2243 views
  • 1 like
  • 4 in conversation