BookmarkSubscribeRSS Feed
mathias
Quartz | Level 8

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

'gcdata1'=white

 

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;
  run;

 

and I'm viewing it in STP output (default ods, it creates PNG's inside an html page)

4 REPLIES 4
DanH_sas
SAS Super FREQ

Just use the NOOUTLINE option on the VBAR statement -- no style change necessary.

 

Hope this helps!

Dan

mathias
Quartz | Level 8
I think I tried that and that doesn't remove the border in the legend. Will try again tomorrow to confirm or not.
DanH_sas
SAS Super FREQ

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.

 

Thanks!

Dan

mathias
Quartz | Level 8

That's probably only for 9.4.

Not working on my system (SAS9.3, EG 7.1, windows7, 64bit)

265 + keylegend / autooutline;
___________
22
202
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.

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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
  • 4 replies
  • 4530 views
  • 0 likes
  • 2 in conversation