We have created a panel bar graph with lines representing benchmark values. We used a keylegend statement to define the line portions of the figures, but the lines are too faint to visually discern the colors or patterns easily. I suspect it is an issue of the legend's transparency so I tried to implement the opaque option but received an error. Is the opaque option available in SAS 9.4? If the opaque option is not available to me, does anyone have any suggestions for changing the line thickness in the legend?
Here is an excerpt of the code from the proc sgpanel:
keylegend "Norm" "Sample Mean" / down = 1 titleattrs=(color = black size = 10) noborder position = top opaque;
Here is the language from the error message:
ERROR 22-322: Syntax error, expecting one of the following: ;, ACROSS, AUTOITEMSIZE, AUTOOUTLINE, BORDER, DOWN, EXCLUDE, FILLASPECT, FILLHEIGHT, LINELENGTH, NOBORDER, OUTERPAD, POSITION, SCALE, SORTORDER, TITLE, TITLEATTRS, TYPE, VALUEATTRS.
ERROR 202-322: The option or parameter is not recognized and will be ignored.
Opaque is a valid option in SAS 9.4 for SGPLOT, but not for SGPANEL according to the documentation.
No, if you provide a reproducible sample, ie make your code work with a SASHELP data set, I'm happy to look into it but it's hard to do without data or code. Hopefully someone else in this forum, (the SAS staff hopefully) will have a response soon. If not, I'll tag them eventually 😄
Thanks! Do you have a suggestion for an alternative within SGPANEL that would make the legend readable?
As a minimum show the entire Proc SGPanel code you are currently using.
If you are setting attributes in the plot that are transparent then you are going to have issues as the legend attempts to replicate those.
Reduce transparency settings if you are using them.
Make the displayed elements a bit larger perhaps, line width or marker size.
Use an ANNOTATE data to create a legend from scratch.
Perhaps use SGPLOT with one or more BY variables.
Move the Graphic template language where there may be more controls with a Layout Lattice that Sgpanel does not honor.
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.