GPLOT titling issue
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?
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.
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);
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
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.
Ready to level-up your skills? Choose your own adventure.