Data visualization with SAS programming

Styles, etc.

Accepted Solution Solved
Reply
N/A
Posts: 1
Accepted Solution

Styles, etc.

How do I apply a style to a title or a footer? 


Accepted Solutions
Solution
‎02-03-2012 08:27 AM
SAS Employee
Posts: 977

Styles, etc.

I'd like to add a little to Dan's "it depends"...  Smiley Happy

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";

View solution in original post


All Replies
Super User
Posts: 11,101

Styles, etc.

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.

SAS Super FREQ
Posts: 925

Styles, etc.

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

Solution
‎02-03-2012 08:27 AM
SAS Employee
Posts: 977

Styles, etc.

I'd like to add a little to Dan's "it depends"...  Smiley Happy

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";

SAS Super FREQ
Posts: 8,814

Re: Styles, etc.

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;

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 4 replies
  • 211 views
  • 7 likes
  • 5 in conversation