Hi, I am using SG panel to achieve something similar to the below graph. I can't get it right. Any help would be appreciated.
Not sure if SG panel is the right option or should I use 4 separate SG PLOT?
(I am hiding some data for confidentiality)
The legend should be appear below for each Rating Type per graph.
Example: Graph3
My code and output
data prep;
infile datalines dlm=" ";
input EXCEPTION $15.LOB $2. pcnt_excpt_ratings;
datalines;
TYPE1_Variance B 2
TYPE2_Variance D 3
TYPE2_Variance B 11
TYPE2_Variance A 3
TYPE2_Variance C 19
TYPE3_Variance A 0
TYPE3_Variance B 4
TYPE3_Variance C 2
TYPE3_Variance D 0
TYPE4_Variance D 0
TYPE4_Variance B 1
TYPE4_Variance A 0
TYPE4_Variance C 1
TYPE5_Variance B 1
;
run;
title "Overall Exceptions as % of each LOB's Ratings";
proc sgpanel data=prep;
panelby lob / novarname sparse;
vbar Exception /response=pcnt_excpt_ratings group=Exception datalabel;
colaxis values=(0 to 12 by 2);
rowaxis refticks=(values) grid display=none;
keylegend / position=bottom;
run;
title;
Easy to try: If you data is not sorted by your LOB variable then do so. Then try SGPLOT with a BY LOB;
If that makes 4 graphs the way you want each to appear you are on your way.
You can use #byval in title statements to get the information you have in the "boxes" of the titles.
However you won't get a 2 rows of graphs with SGPLOT.
Nearly 200 sessions are now available on demand with the SAS Innovate Digital Pass.
Explore Now →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.