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

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

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.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

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

View all other training opportunities.

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