data barley; length variety $12; length site $20; input yield variety $ year site $; label yield="Barley Yield (bushels /acre)"; label year="Year"; label variety="Variety"; format yield 5.2; datalines; 39.93 Manchuria 1931 Crookston 38.13 Glabron 1931 Crookston 40.47 Svansota 1931 Crookston 41.33 Velvet 1931 Crookston 46.93 Trebi 1931 Crookston 48.57 No.462 1931 Crookston 41.60 Peatland 1931 Crookston 49.87 Wisconsin 1931 Crookston 32.97 Manchuria 1932 Crookston 26.17 Glabron 1932 Crookston 20.63 Svansota 1932 Crookston 32.07 Velvet 1932 Crookston 41.83 Trebi 1932 Crookston 30.53 No.462 1932 Crookston 25.23 Peatland 1932 Crookston 35.90 Wisconsin 1932 Crookston 28.97 Manchuria 1931 Duluth 29.67 Glabron 1931 Duluth 25.70 Svansota 1931 Duluth 26.30 Velvet 1931 Duluth 33.93 Trebi 1931 Duluth 28.10 No.462 1931 Duluth 32.00 Peatland 1931 Duluth 31.60 Wisconsin 1931 Duluth 22.57 Manchuria 1932 Duluth 25.87 Glabron 1932 Duluth 22.23 Svansota 1932 Duluth 22.47 Velvet 1932 Duluth 30.60 Trebi 1932 Duluth 22.50 No.462 1932 Duluth 31.37 Peatland 1932 Duluth 29.33 Wisconsin 1932 Duluth 27.43 Manchuria 1931 Morris 28.77 Glabron 1931 Morris 25.77 Svansota 1931 Morris 26.13 Velvet 1931 Morris 43.77 Trebi 1931 Morris 30.37 No.462 1931 Morris 29.87 Peatland 1931 Morris 29.47 Wisconsin 1931 Morris 34.37 Manchuria 1932 Morris 35.13 Glabron 1932 Morris 35.03 Svansota 1932 Morris 38.83 Velvet 1932 Morris 46.63 Trebi 1932 Morris 47.00 No.462 1932 Morris 43.20 Peatland 1932 Morris 47.17 Wisconsin 1932 Morris 48.87 Manchuria 1931 Waseca 55.20 Glabron 1931 Waseca 47.33 Svansota 1931 Waseca 50.23 Velvet 1931 Waseca 63.83 Trebi 1931 Waseca 65.77 No.462 1931 Waseca 48.57 Peatland 1931 Waseca 58.80 Wisconsin 1931 Waseca 33.47 Manchuria 1932 Waseca 37.73 Glabron 1932 Waseca 38.50 Svansota 1932 Waseca 37.40 Velvet 1932 Waseca 49.23 Trebi 1932 Waseca 44.70 No.462 1932 Waseca 36.03 Peatland 1932 Waseca 58.17 Wisconsin 1932 Waseca ; run; proc print;run; proc sort data=barley; by site; run; proc template; define style listingSF; parent = Styles.Listing; style GraphFonts from GraphFonts "Fonts used in graph styles" / 'GraphValueFont' = (", ",8pt) 'GraphLabelFont' = (", ",10pt, bold) ; end; run; %let gpath='C:\Work\Blogs\Graphically Speaking\2012\Post_18Mar_2012_Class_Panels'; ods listing style=listingSF image_dpi=100 gpath=&gpath; /*--Car Histogram--*/ ods graphics on / reset width=4in height=2.5in imagefmt=png imagename="CarHist"; title "Mileage Distribution"; proc sgplot data=sashelp.cars; where type ne 'Hybrid'; histogram mpg_city; density mpg_city; density mpg_city / type=kernel; xaxis display=(nolabel); yaxis grid; run; /*--Car Histogram ColPanel--*/ ods graphics on / reset width=5in height=2.5in noscale imagefmt=png imagename="CarHistPanel"; title "Mileage Distribution"; proc sgpanel data=sashelp.cars; where type ne 'Hybrid'; panelby origin / novarname rows=1; histogram mpg_city; density mpg_city; density mpg_city / type=kernel; colaxis display=(nolabel); rowaxis grid; run; /*--Car Histogram RowLattice--*/ ods graphics on / reset width=3in height=5in noscale imagefmt=png imagename="CarHistRowLattice"; title "Mileage Distribution"; proc sgpanel data=sashelp.cars; where type ne 'Hybrid'; panelby origin / novarname layout=rowlattice; histogram mpg_city; density mpg_city; density mpg_city / type=kernel; colaxis display=(nolabel); rowaxis grid; run; /*--Car Histogram DataLattice--*/ ods graphics on / reset width=5in height=3in noscale imagefmt=png imagename="CarDataLattice"; title "Mileage by Horsepower"; proc sgpanel data=sashelp.cars; where type eq 'Sedan' or type eq 'Sports' or type eq 'Wagon'; panelby origin type / novarname layout=lattice onepanel; scatter x=horsepower y=mpg_city / markerattrs=(symbol=circlefilled) transparency=0.8; reg x=horsepower y=mpg_city / nomarkers; colaxis grid; rowaxis grid; run; /*--Barley graph--*/ ods graphics on / reset width=3in height=6in noscale imagefmt=png imagename="Barley"; title "Barley Yield by Variety"; proc sgpanel data=barley; panelby site / novarname layout=rowlattice onepanel; dot variety / response=yield group=year markerattrs=(size=11); discretelegend; rowaxis display=(nolabel); run; title; footnote;