BookmarkSubscribeRSS Feed
_LB
Fluorite | Level 6 _LB
Fluorite | Level 6
Hello all;
Does anyone know how to set the background color for an inset statement, either within the statement or through a template? It does not seem to have that option within the inset statement. Problem I have is the overlay of text disappears.
Or...
using a legend statement that I can put in free text that can go outside the graph?
ie
Rn=x
Md=y
etc etc.

Either way works for me.
Thank you.

Lawrence
5 REPLIES 5
GraphGuy
Meteorite | Level 14
Which proc are you using?

I assume something GTL-based?
(proc sgplot? a SAS/STAT proc with "ods graphics on"?)
_LB
Fluorite | Level 6 _LB
Fluorite | Level 6
sorry about that-I am using SGPLOT. I managed to use offsetmax to get by, but still looking at other solutions.

Thanks.

Lawrence
DanH_sas
SAS Super FREQ
Unfortunately, there is currently not a way to set the background color for the INSET statement in SGPLOT. I would recommend calling Technical Support and making a request for this feature. In the meantime, you can work around this by getting SGPLOT to generate the GTL code and modifying it to set the background color.

First, specify TMPLOUT="temp.sas" on the SGPLOT proc statement to generate the GTL in "temp.sas". In the GTL, you will find a LAYOUT GRIDDED that contains your inset values. On that LAYOUT GRIDDED, specify these two options:

opaque=true backgroundcolor=

At the end of the file, add this procedure call and submit the code:

proc sgrender data=yourdataset template=sgplot; run;

You should see your background color.

Thanks!
Dan
_LB
Fluorite | Level 6 _LB
Fluorite | Level 6
Dan;
It sort of worked...It did generate the temp.sas file and I did modify it. And it does make the box white but when I add the

proc sgrender data=yourdataset template=sgplot; run;


statement it leaves out the the actual data. Plus it renders it as an image not as a RTF file as specified. I can change the GTL if I actually can find the parent style?
Or somehow create a new template with the LAYOUT GRIDDED option. I am a newbie at GTL, so it may take some doing....


Thanks again.

Lawrence
DanH_sas
SAS Super FREQ
You will need to wrap the PROC SGRENDER code with the same ODS statements as your SGPLOT code. Basically, the SGRENDER binds the data with the GTL template to create the graph. Be sure to replace "yourdataset" with the dataset from the SGPLOT code.

Thanks!
Dan Message was edited by: DanH@sas

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