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
Super User

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 2024

Innovate_SAS_Blue.png

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. 

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.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 7 replies
  • 1092 views
  • 3 likes
  • 4 in conversation