BookmarkSubscribeRSS Feed
JohnH
Fluorite | Level 6

GPLOT titling issue

I am using V9.2 for Windows.

I have 4 title lines, TITLE1-4, that I want to output. Everything worked until I tried to reuse TITLE2 for a second plot. If I define TITLE2 after defining TITLE3 & TITLE4, the last 2 title lines don't come out.  Is there a way to preserve titles 3 & 4 when I change title 2?

2 REPLIES 2
Astounding
PROC Star

John,

Can't be done, sort of.  Titles are designed to work that way.  Quick, short solutions include changing the order of the titles so that the one that changes is the last one, or repeating your TITLE3 and TITLE4 statements once you change TITLE2.

In theory, you could write a macro to do this.  After all, current title settings are stored in dictionary.titles.  So you could capture the current settings, replace TITLE2, and then use the captured values to reinstate TITLE3 and TITLE4.  But nobody I know has ever wanted to jump through that hoop.  The quick solutions I first mentioned are the ones that most people choose.

Good luck.

ballardw
Super User

If this occurs in enough places and you don't want to copy paste a lot, especially when making changes you could use a short macro.

%macro bottomtitles;

title3 "Your title3 text goes here";

title4 "Your title4 text goes here";

%mend;

Use

Title2 "New title2 text";

%bottomtitles;

Or possibly slicker have IF TITLE2 is the only one that changes and changes often:

%macro MyTitles(title2);

Title1 "Title1 text";

title2 "&title2";

title3 "Your title3 text goes here";

title4 "Your title4 text goes here";

%mend;

Use:

%MyTitles(This is the first text for title2);

and later

%MyTitles(This is the later text for title2);

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 2 replies
  • 864 views
  • 0 likes
  • 3 in conversation