BookmarkSubscribeRSS Feed
labin
Fluorite | Level 6

Why don't the labels for the colors in my stacked chart show at the bottom?

title "100% Stacked Bar Chart";
proc sgplot data = freqout keylegend;
vbar Event_Entered_Month / response=Percent group = buckets groupdisplay=stack;
xaxis discreteorder=data DISPLAY=ALL;
yaxis grid values=(0 to 100 by 10) DISPLAY=ALL label = "Percentage of Total by Month" ;
run;
1 REPLY 1
DanH_sas
SAS Super FREQ

KEYLEGEND is not an option on the PROC SGPLOT statement -- it is its own statement. For this example, the legend should automatically appear, unless the legend takes up greater than 20% of the graph area (check your log for a note). If it is dropped due to size, you can adjust that size threshold by using the MAXLEGENDAREA option on the ODS GRAPHICS statement. There is a NOAUTOLEGEND option on the PROC statement that disables this automatic legend. The KEYLEGEND statement can be used to create a custom legend or modify attributes of the automatic legend. See the documentation for examples.

 

Hope this helps!

Dan

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

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

View all other training opportunities.

Discussion stats
  • 1 reply
  • 669 views
  • 0 likes
  • 2 in conversation