As Dan and Snoopy have suggested, GTL and SG features were not fully fleshed out in SAS 9.2. SAS 9.3 is better. However, there is a way to get what you want with a little bit of work. Transform your data from a "Group" structure to a "Multi-Variable" structure. Then you can use the DISCRETEOFFSET option in GTL to get what you want. Note, you have to some extra work to know how many unique group values you want, and set up the details yourself. Attached is a simple example, where I have transformed the mpg_city by Type and Origin data for SASHELP.CARS into TYPE and 3 columns for MPG, one each for USA, Asia and Europe. I did it the simple way using data step. Then, you can overlay three BOXPLOT statements, each with the right amount of DISCRETEOFFSET and BOXWIDTH to get what you want. You have to use GTL as DISCRETEOFFSET was a late breaking option at 9.2 for just such use cases. There was no time to add it to SGPLOT. Colors come from style using CYCLEATTRS. To change group colors, change the style. See code and graph. data trans; set sashelp.cars(keep=origin type mpg_city where=(type ne 'Hybrid')); drop mpg_city; if Origin eq 'USA' then USA=mpg_city; if Origin eq 'Asia' then Asia=mpg_city; if Origin eq 'Europe' then Europe=mpg_city; run; proc template; define statgraph BoxPlot; begingraph; entrytitle 'Mileage Distribution by Type and Origin'; layout overlay / cycleattrs=true xaxisopts=(display=(ticks tickvalues)) yaxisopts=(label='Mileage'); boxplot x=type y=usa / discreteoffset=-0.25 boxwidth=0.2 name='a' legendlabel='USA'; boxplot x=type y=Asia / discreteoffset=0 boxwidth=0.2 name='b' legendlabel='Asia'; boxplot x=type y=Europe / discreteoffset= 0.25 boxwidth=0.2 name='c' legendlabel='Europe'; discretelegend 'a' 'b' 'c' / Title='Origin:'; endlayout; endgraph; end; run; ods listing; proc sgrender data=trans template=BoxPlot; run;
... View more