Thanks - I was on this same trajectory but I did not think about having multiple FACs - I used a different column to splay the data out thinking that since the sum when the bar is sorted would be the same. This is the final version - I do think it would be a great if you could have a sg render procedure that allow for different input datasets. With only 4 metrics and 4 facs this is not a huge deal but the actual report will have 50 facs and 8 metrics as well as a parameter that has another 8 measures in it so the dataset will be huge feeding this graph. data data2; infile datalines delimiter=','; infile datalines dsd; input FAC1 $ FAC2 $ FAC3 $ FAC4 $ Metric1a Metric1b Metric2a Metric2b Metric3a Metric3b Metric4a Metric4b; label Fac='Fac', Metric1a='Curr', Metric1b='Prior', Metric2a='Curr' ,Metric2b='Prior', Metric3a='Curr' ,Metric3b='Prior',Metric4a= 'Curr' ,Metric4b='Prior' ; datalines; OAK,,,,100,50,,,,,, SFO,,,,90,40,,,,,, WLA,,,,70,10,,,,,, BP,,,,60,50,,,,,, ,SFO,,,,,100,150,,,, ,WLA,,,,,200,150,,,, ,BP,,,,,120,150,,,, ,OAK,,,,,190,150,,,, ,,WLA,,,,,,40,10,, ,,BP,,,,,,30,40,, ,,OAK,,,,,,60,50,, ,,SFO,,,,,,20,20,, ,,,BP,,,,,,,10,5 ,,,OAK,,,,,,,30,40 ,,,SFO,,,,,,,60,50 ,,,WLA,,,,,,,20,20 ; run; PROC SQL; CREATE TABLE NEW AS SELECT * FROM DATA2 ORDER BY METRIC1a DESC, METRIC2a DESC, METRIC3a DESC, METRIC4a DESC; QUIT; ODS PATH (prepend) MIAIDR.templat(update); proc template; define statgraph KPRLPOWideBar; dynamic x1 x2 x3 x4 y1a y1b y2a y2b y3a y3b y4a y4b y5a y5b y6a y6b y7a y7b y8a y8b titlelabel1 titlelabel2 titlelabel3 titlelabel4 titlelabel5 titlelabel6 titlelabel7 titlelabel8 datalabel2 datalabel3 graphtitle1 graphtitle2 graphtitle3 refline legendlabel minscale maxscale value1; begingraph / border=false designwidth=7in ; layout lattice / columns=2 rows=4 rowgutter=5px columngutter=5px; layout overlay / XAXISOPTS=(griddisplay=off display=(ticks tickvalues)) YAXISOPTS=(griddisplay=on label=TITLELABEL1 linearopts=(tickvalueformat=(extractscale=true)) offsetmax=0.2) BORDER=false; BARCHART x=x1 y=y1a / fillattrs=(color=CX8CB9CA) outlineattrs=(color=CX8CB9CA) name="CURR" legendlabel="Current Year" tip=(x group y) IncludeMissingGroup=False; BARCHART x=x1 y=y1b / barwidth=.3 fillattrs=(color=CX135589) outlineattrs=(color=CX135589) name="LAST" legendlabel="Last Year" tip=(x group y); endlayout; layout overlay / XAXISOPTS=(griddisplay=off display=(ticks tickvalues)) YAXISOPTS=(griddisplay=on label=TITLELABEL1 linearopts=(tickvalueformat=(extractscale=true)) offsetmax=0.2) BORDER=false; BARCHART x=x2 y=y2a / fillattrs=(color=CX8CB9CA) outlineattrs=(color=CX8CB9CA) name="CURR" legendlabel="Current Year" tip=(x group y) IncludeMissingGroup=False; BARCHART x=x2 y=y2b / barwidth=.3 fillattrs=(color=CX135589) outlineattrs=(color=CX135589) name="LAST" legendlabel="Last Year" tip=(x group y); endlayout; layout overlay / XAXISOPTS=(griddisplay=off display=(ticks tickvalues)) YAXISOPTS=(griddisplay=on label=TITLELABEL1 linearopts=(tickvalueformat=(extractscale=true)) offsetmax=0.2) BORDER=false; BARCHART x=x3 y=y3a / fillattrs=(color=CX8CB9CA) outlineattrs=(color=CX8CB9CA) name="CURR" legendlabel="Current Year" tip=(x group y) IncludeMissingGroup=False; BARCHART x=x3 y=y3b / barwidth=.3 fillattrs=(color=CX135589) outlineattrs=(color=CX135589) name="LAST" legendlabel="Last Year" tip=(x group y); endlayout; layout overlay / XAXISOPTS=(griddisplay=off display=(ticks tickvalues)) YAXISOPTS=(griddisplay=on label=TITLELABEL1 linearopts=(tickvalueformat=(extractscale=true)) offsetmax=0.2) BORDER=false; BARCHART x=x4 y=y4a / fillattrs=(color=CX8CB9CA) outlineattrs=(color=CX8CB9CA) name="CURR" legendlabel="Current Year" tip=(x group y) IncludeMissingGroup=False; BARCHART x=x4 y=y4b / barwidth=.3 fillattrs=(color=CX135589) outlineattrs=(color=CX135589) name="LAST" legendlabel="Last Year" tip=(x group y); endlayout; sidebar / align=top; discretelegend "CURR" "LAST" / border=off pad=(top=10px); endsidebar; sidebar / align=bottom; discretelegend "CURR" "LAST" / border=off pad=(top=10px); endsidebar; endlayout; endgraph; end; run; ods graphics on / imagemap border=off height=8in width=5in; proc sgrender data=work.NEW template=KPRLPOWideBar; dynamic x1 = 'fac1' x2 = 'fac2' x3 = 'fac3' x4 = 'fac4' y1a = 'Metric1a' y1b= 'Metric1b' y2a= 'Metric2a' y2b= 'Metric2b' y3a= 'Metric3a' y3b= 'Metric3b' y4a= 'Metric4a' y4b= 'Metric4b' titlelabel1 = 'Metric1' titlelabel2 = 'Metric2' titlelabel3 = 'Metric3' titlelabel4 = 'Metric4' ; run; ods graphics off;
... View more