BookmarkSubscribeRSS Feed
Sami
Obsidian | Level 7

Hi,

I need a solution to set Background color YELLOW on SGPLOT:

-I am using SAS 9.2 and creating PNG.

-However,I have tried to solve it via PROC TEMPLATE but it not working?

   proc template;

     define style styles.default ;

     parent = styles.Journal;

     style GraphLegendBackground / color=Yellow;

     style GraphFonts /   

     'GraphDataFont' =("Arial",10pt)

     'GraphUnicodeFont' = ("Arial",6.5pt)

     'GraphValueFont'=("Arial",7.0pt,bold)

     'GraphLabelFont'=("Arial",8.2pt,bold)

     'GraphFootnoteFont' = ("Arial",8pt)

     'GraphTitleFont' = ("Arial",10pt,bold)

     'GraphAnnoFont' = ("Arial",10pt);

     end;

   run;

-But not changing LEGEND Background Color, all other stuffs are okay from that figures.

Thanks in advance

3 REPLIES 3
DanH_sas
SAS Super FREQ

It looks like your creating a circular dependency. Normally, the JOURNAL style inherits from DEFAULT, but here you have overridden DEFAULT and inherited from JOURNAL. Try this instead:

  proc template;

     define style styles.myjournal ;  /* different name */

     parent = styles.Journal;

     style GraphLegendBackground / color=Yellow;

     style GraphFonts /  

     'GraphDataFont' =("Arial",10pt)

     'GraphUnicodeFont' = ("Arial",6.5pt)

     'GraphValueFont'=("Arial",7.0pt,bold)

     'GraphLabelFont'=("Arial",8.2pt,bold)

     'GraphFootnoteFont' = ("Arial",8pt)

     'GraphTitleFont' = ("Arial",10pt,bold)

     'GraphAnnoFont' = ("Arial",10pt);

     end;

   run;

ods pdf file="output.pdf" style=myjournal; /* or whatever ODS destination you are using */

< your program >

ods pdf close;

Hope this helps!

Dan

Sami
Obsidian | Level 7

It not worked on after using on:

ODS LISTING GPATH="XX" style=myjournal;

ODS LISTING CLOSE

Jay54
Meteorite | Level 14

It is worth pausing to consider if this is a good idea.  Color perception is not absolute, but relative to the background.  We know that a gray color swatch in black background looks white, and the same gray color in a white background looks black.  We intentionally use the same background color as the "Wall" color for the legend, so the colors used in the graph are seen against the same background in the legend.  Changing the legend background color to something different from the wall color could have an adverse impact on the perception of the colors.

sas-innovate-wordmark-2025-midnight.png

Register Today!

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.


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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 1996 views
  • 0 likes
  • 3 in conversation