- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I'm creating a graph using Proc SGPLOT. I'm adding this graph to a RTF document. I have attached my code as well as a screen snapshot of the graph.
- I would like to add background color to the graph. I tried using Proc Template to add background color but it doesn't seem to work. Can you please guide me as to what I may be doing wrong?
- How do I remove the outer boundary of the graph? I suspect that once I get the Proc Template to work, it'll be possible.
Thank you very much for your guidance!
SM
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Great! Then, this will be straightforward:
1. To get rid of the outer border, use the NOBORDER option on the ODS GRAPHICS statement:
ods graphics / noborder;
2. Use the BACKCOLOR option on the STYLEATTRS statement in PROC SGPLOT to set a background color:
proc sgplot data=whatever;
styleattrs backcolor=cxffffff;
hbar ... ;
run;
Other related options that might interest you are the WALLCOLOR option on the STYLEATTRS statement, as well as the NOWALL and NOBORDER options on the PROC SGPLOT statement. These "NO" options control the visibility of the wall fill area (NOWALL) and the wall border (NOBORDER).
Hope this helps!
Dan
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Now you are using SGPLOT, try to use the option TMPLOUT= to export the SGPLOT template and then try to add this option BACKGROUNDCOLOR= style-reference | color.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Outside my SAS program, I export the template.
- Then, modify the template.
- finally, bring in the template?
Please clarify
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi smajid,
Yes, with TMPLOUT a .sas file is generated. This sas file contain the proc template necessary to generate the shell to produce your output. You could modify this code, including the background. Each proc template give a name to the shell.
proc template;
define statgraph _TMPLNAME_;
After that, you could use a proc sgrender to use your original dataset and your modified template to produce the desired output.
proc sgrender data=_IN_ template=_TMPLNAME_;
run;
I hope that it is now clearer
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
What version of SAS are you using? There have been options added to SGPLOT that can do both of your items in a straightforward way.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
DanH_sas,
Thank you for your response!
I'm using SAS Studio v3.5. The sas engine is: SAS release: 9.04.01M3P06242015
It is the SAS OnDemand for Academics.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Great! Then, this will be straightforward:
1. To get rid of the outer border, use the NOBORDER option on the ODS GRAPHICS statement:
ods graphics / noborder;
2. Use the BACKCOLOR option on the STYLEATTRS statement in PROC SGPLOT to set a background color:
proc sgplot data=whatever;
styleattrs backcolor=cxffffff;
hbar ... ;
run;
Other related options that might interest you are the WALLCOLOR option on the STYLEATTRS statement, as well as the NOWALL and NOBORDER options on the PROC SGPLOT statement. These "NO" options control the visibility of the wall fill area (NOWALL) and the wall border (NOBORDER).
Hope this helps!
Dan
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
DanH_sas,
Thank you very much! I tried your two recommendations and they worked. Appreciate your help a lot!
SM