BookmarkSubscribeRSS Feed
Jaime
Fluorite | Level 6
Hi all,
I am using sgpot in a stored proc to output a report on the IDP.
I can seem to figure out how to control the chart background color of my sgplot output. I an using the below template.

proc template;
define style mystyle;
parent=styles.STATISTICAL;
class body/
backgroundcolor=white
color=black
fontfamily="Verdana, Arial" ;
class systemtitle/
fontfamily="Verdana, Arial"
fontweight=bold
fontsize=14;
class table/
backgroundcolor=white
bordercolor=black
borderstyle=solid
borderwidth=1pt ;
class header, footer/
backgroundcolor=green
fontfamily="Verdana, Arial"
fontweight=bold ;
class data/
fontfamily="Verdana, Arial";
style graphcolors from graphcolors /
'gcdata1'=Darkseagreen
'gcdata2'=Khaki
'gcdata3'=Darkslateblue
'gdata1'=Darkseagreen
'gdata3'=Darkslateblue
'gdata4'=CXDC531F
'gdata2'=Khaki;
style GraphBackground
"Graph backgroundcolor attributes" /
backgroundcolor = colors("white")
textalign = L
verticalalign = B;

end;
run;

I then pass this to the %STPBEGIN macro. %let _ODSSTYLE=mystyle;


This section in my proc creates the plot:
ods graphics / reset width=500px height=333px noborder;
proc sgplot data=repo.No_Activity_018 ;
vbar Inactive_Days_Bin /group=Plan ;
run;
quit;

I can't find any reference to overridding the background color directly in SGPLOT in the SAS documentation.
6 REPLIES 6
DanH_sas
SAS Super FREQ
I think if you remove the colors("white") and replace it with just "white" (no quotes), does it work for you?
Jaime
Fluorite | Level 6
No.

style GraphBackground
"Graph backgroundcolor attributes" /
backgroundcolor = white
textalign = L
verticalalign = B;

It compiles, but the color is still gray.
Cynthia_sas
Diamond | Level 26
Hi:
Can you look in the log for errors or notes. I'm guessing that your updated style template is not found on the server where output for the IDP is being created. You should see a note in the log to the effect:
[pre]
WARNING: Style xxxxxxxx not found; Default style will be used instead.
[/pre]

You might want to work with Tech Support on this issue. Depending on when/how/where your template is being compiled and saved, you may need an ODS PATH statement so that the Stored Process can find the updated template.

Have you tested your style template code in Base SAS (outside a Stored Process to make sure that the code has the desired result)??

cynthia
Jaime
Fluorite | Level 6
OK.
Well on that note, how do I view the log on a stored procedure running on Stored Procedure server?
DanH_sas
SAS Super FREQ
Try setting the color to the COLOR attribute instead of the BACKGROUNDCOLOR attribute. For ODS GRAPHICS, I believe is where the color os retrieved.

Thanks!
Dan
Jaime
Fluorite | Level 6
Disregard.
DanH ur initial suggestion of " backgroundcolor = white " worked.
I did not see the results as I am using the tagsets.tableeditor template and this that script happpends to create a style tmeplate also called MyStyle. This was replacing my style template.

Thanks.

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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