How do I apply a style to a title or a footer?
I'd like to add a little to Dan's "it depends"...
If you're using traditional SAS/Graph procs (such as gplot, gchart, and gmap) in 9.2 or higher, the ODS styles can affect the color of the titles ... but it can vary, depending on whether you're using 'gtitles' or 'nogtitles'.
For example, when I run the following code with gtitles (titles inside the png image), they are black, but when I run it with nogtitles (titles are in the html, not part of the png image), they are blue:
%let name=plt080;
filename odsout '.';
GOPTIONS DEVICE=png;
goptions gunit=pct htitle=6.0 htext=4.5 ftitle="arial/bo" ftext="arial";
ODS LISTING CLOSE;
ODS HTML path=odsout body="&name..htm" nogtitle style=sasweb;
title1 "What color is my title1?";
title2 "What color is my title2?";
proc gplot data=sashelp.class;
plot height*weight /
des="" name="&name";
run;
quit;
ODS HTML CLOSE;
ODS LISTING;
Therefore, if you want to guarantee your title is the desired color (no matter how the graph is produced), I recommend hard-coding the color in the title statement, such as ...
title1 color=hotpink "This is my title";
If you want to change the appearance of all titles and footers in a consistent manner the optimal way would be to use PROC TEMPLATE and create a new custom style based on an existing SAS supplied one.
If you need to just modify one (or some specific) title / footer then look in the online help for "enhancing titles" under the "Title Statement" entry in the index for examples of font changes like color and size and such.
The answer to the question depends on how you're creating your graphs. ODS styles affect all graph output and is a good place to make persistent style changes. If you are using SAS/GRAPH procedures or the SG procedures, you can also modify titles and footnotes directly via the TITLE/FOOTNOTE statements. If you are using the Graph Template Language (GTL), TITLE/FOOTNOTE statements do not apply. You would need to make direct title and footnote changes on the ENTRYTITLE/ENTRYFOOTNOTE statements in the template.
Hope this helps,
Dan
I'd like to add a little to Dan's "it depends"...
If you're using traditional SAS/Graph procs (such as gplot, gchart, and gmap) in 9.2 or higher, the ODS styles can affect the color of the titles ... but it can vary, depending on whether you're using 'gtitles' or 'nogtitles'.
For example, when I run the following code with gtitles (titles inside the png image), they are black, but when I run it with nogtitles (titles are in the html, not part of the png image), they are blue:
%let name=plt080;
filename odsout '.';
GOPTIONS DEVICE=png;
goptions gunit=pct htitle=6.0 htext=4.5 ftitle="arial/bo" ftext="arial";
ODS LISTING CLOSE;
ODS HTML path=odsout body="&name..htm" nogtitle style=sasweb;
title1 "What color is my title1?";
title2 "What color is my title2?";
proc gplot data=sashelp.class;
plot height*weight /
des="" name="&name";
run;
quit;
ODS HTML CLOSE;
ODS LISTING;
Therefore, if you want to guarantee your title is the desired color (no matter how the graph is produced), I recommend hard-coding the color in the title statement, such as ...
title1 color=hotpink "This is my title";
And, to add onto Robert & Dan's postings, if you are using ODS destinations that support style - -even if you are NOT using SAS/GRAPH or GTL, you can have an impact on your title statement for RTF, PDF and HTML, by doing this:
title1 color=hotpink font='Arial Narrow' bold h=14pt "This is my title";
and the ODS destinations that support style will use your title specifications.
cynthia
ods rtf file='c:\temp\hotpink.rtf';
ods pdf file='c:\temp\hotpink.pdf';
ods html file='c:\temp\hotpink.html';
title1 color=hotpink font='Arial Narrow' bold h=14pt "This is my title";
proc print data=sashelp.class(obs=2);
run;
ods _all_ close;
title;
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.