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.
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;
@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
What version of SAS are you in?
Hi @PeterClemmensen .
I use SAS 9.4.
Thanks.
@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
Hi @djrisks .
Thanks for your reply.
Yes I tried keylegend.
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
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"
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
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.
Ready to level-up your skills? Choose your own adventure.