BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Miracle
Barite | Level 11

Dear All,
Can I please ask how do we increase the line thickness in legend?
And how do we add a black thin border around the bars and as well as to the legend entries?

Thanks a lot.

2020-10-27_0-10-21.png

Proc sgplot data=final;
vbar vara / group=xvar response=percent seglabel seglabelformat=f6.2 
grouporder=data ;

keylegend /* "0" "1" "2" "3" "4" "5" "6" "7" "8"*/ / 
title=" " across=2 down=3 scale=2 valueattrs=(size=8) fillheight=10 noborder type=line  ;

xaxis label=" " values=(1,2,3,4,5,6,7,8,9,10) 
valuesdisplay=("1st (&c1.)" "2nd (&c2.)" "3rd (&c3.)" "4th (&c4.)"  "5th (&c5.)"  
"6th (&c6.)" "7th (&c7.)"  "8th (&c8.)" "9th (&c9.)" "10th(&c10.)") 
valueattrs=(size=7pt); 

yaxis label=" " values = (0 to 100 by 10) valuesdisplay=("0%" "10%" "20%" "30%" "40%" "50%" "60%" "70%" "80%" "90%" "100%");
run;
1 ACCEPTED SOLUTION

Accepted Solutions
djrisks
Barite | Level 11

@Miracle If you use GTL, you can use the legenditem statement to increase the line thickness of the legend. For example:

 

legenditem type=markerline name="placebo" / lineattrs=(color=bib pattern=1 thickness=5) label="Placebo";

 

If you upload the final dataset or a sample dataset, I can show you an example.

 

Thanks,


Kriss Harris

View solution in original post

7 REPLIES 7
PeterClemmensen
Tourmaline | Level 20

What version of SAS are you in?

Miracle
Barite | Level 11

Hi @PeterClemmensen .
I use SAS 9.4.

Thanks.

djrisks
Barite | Level 11

@Miracle If you use GTL, you can use the legenditem statement to increase the line thickness of the legend. For example:

 

legenditem type=markerline name="placebo" / lineattrs=(color=bib pattern=1 thickness=5) label="Placebo";

 

If you upload the final dataset or a sample dataset, I can show you an example.

 

Thanks,


Kriss Harris

Miracle
Barite | Level 11

Hi @djrisks .
Thanks for your reply.
Yes I tried keylegend.

djrisks
Barite | Level 11

Hi @Miracle, please look at the LEGENDITEM statement, instead of KEYLEGEND.

 

Many thanks,

 

Kriss 

Miracle
Barite | Level 11

Ops, my apologies.
i was meant to say legenditem not keylegend.
Yes, I have used both legenditem and keylegend together.
Thank you all for your response @PeterClemmensen @djrisks @Rick_SAS 

Rick_SAS
SAS Super FREQ

In SAS 9.4M5, PROC SGPLOT supports the LEGENDITEM statement. See the section "Customize items in a legend" in the article "5 tips for customizing legends in PROC SGPLOT in SAS"

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
  • 7 replies
  • 2030 views
  • 3 likes
  • 4 in conversation