I want to remove borders from an sgplot (vbar with group=) both on the bars and in the legend.
in GraphColors template styles, I tried
but it's not applying to the legend ! (the border of the legend marker is black
I tried applying the same color as 'gdata1' but that doesn't work either.
I also tried to use a transparent color Affffff00 but that's not working either (btw that produces a weird bug that makes all the rest of 'gcdata2', 'gcdata3', 4... unused and 'gcdata' is then used instead for all)
My current solution is to use
'gcdata1' = CXfefefe
which is ~ok for my needs
But that's such a strange behavior that I would like to understand.
The plot looks like this
proc sort data=sashelp.class; by sex; run;quit;
proc sgplot data=sashelp.class;
vbar Age / group=Sex groupdisplay=cluster;
and I'm viewing it in STP output (default ods, it creates PNG's inside an html page)
Ah, you are correct! You also have to use the AUTOOUTLINE option on the KEYLEGEND statement. That tells the legend to respond to the outline settings of the plot:
proc sort data=sashelp.class; by sex; run;quit; proc sgplot data=sashelp.class; vbar Age / group=Sex groupdisplay=cluster nooutline; keylegend / autooutline; run;
That should work for you.
That's probably only for 9.4.
Not working on my system (SAS9.3, EG 7.1, windows7, 64bit)
265 + keylegend / autooutline;
ERROR 22-322: Syntax error, expecting one of the following: ;, ACROSS, BORDER, DOWN, LOCATION, NOBORDER, POSITION, TITLE, TITLEATTRS, VALUEATTRS.
ERROR 202-322: The option or parameter is not recognized and will be ignored.
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
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.