Data visualization with SAS programming

INSET background color or legend w/free text outside graph?

Reply
Regular Contributor
Regular Contributor
Posts: 170

INSET background color or legend w/free text outside graph?

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
SAS Employee
Posts: 980

Re: INSET background color or legend w/free text outside graph?

Which proc are you using?

I assume something GTL-based?
(proc sgplot? a SAS/STAT proc with "ods graphics on"?)
Regular Contributor
Regular Contributor
Posts: 170

Re: INSET background color or legend w/free text outside graph?

sorry about that-I am using SGPLOT. I managed to use offsetmax to get by, but still looking at other solutions.

Thanks.

Lawrence
SAS Super FREQ
Posts: 925

Re: INSET background color or legend w/free text outside graph?

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
Regular Contributor
Regular Contributor
Posts: 170

Re: INSET background color or legend w/free text outside graph?

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
SAS Super FREQ
Posts: 925

Re: INSET background color or legend w/free text outside graph?

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
Ask a Question
Discussion stats
  • 5 replies
  • 331 views
  • 0 likes
  • 3 in conversation