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