%let gpath='C:\'; %let dpi=100; ods html close; /*--Create a graph with default style--*/ ods listing style=listing gpath=&gpath image_dpi=&dpi; ods graphics / reset width=4in height=2.5in imagename='ModStyle1'; title "Mileage by Horsepower"; proc sgplot data=sashelp.cars(where=(type='Sports')); scatter x=horsepower y=mpg_city / group=origin; keylegend / location=inside position=topright across=1; xaxis grid; yaxis grid; run; /*--Create a style with custom markers--*/ %modstyle(name=markers, parent=listing, type=CLM, markers=circlefilled trianglefilled diamondfilled) /*--Create a graph with Marker style--*/ ods listing style=markers gpath=&gpath image_dpi=&dpi; ods graphics / reset width=4in height=2.5in imagename='ModStyle2'; title "Mileage by Horsepower"; proc sgplot data=sashelp.cars(where=(type='Sports')); scatter x=horsepower y=mpg_city / group=origin; keylegend / location=inside position=topright across=1; xaxis grid; yaxis grid; run; /*--Create a style with custom colors--*/ %modstyle(name=colors, parent=listing, type=CLM, markers=circlefilled trianglefilled diamondfilled, colors=darkgreen purple orange); /*--Create a graph with Color style--*/ ods listing style=colors gpath=&gpath image_dpi=&dpi; ods graphics / reset width=4in height=2.5in imagename='ModStyle3'; title "Mileage by Horsepower"; proc sgplot data=sashelp.cars(where=(type='Sports')); scatter x=horsepower y=mpg_city / group=origin markerattrs=(size=11); keylegend / location=inside position=topright across=1; xaxis grid; yaxis grid; run; /*--Create a data with index--*/ data cars; set sashelp.cars(where=(type='Sports')); keep horsepower mpg_city index origin; if origin eq 'USA' then index=1; else if origin eq 'Europe' then index=2; else index=3; run; /*--Template for color by index--*/ proc template; define statgraph index; begingraph; entrytitle 'Mileage by Horsepower'; layout overlay; scatterplot x=horsepower y=mpg_city / group=origin index=index markerattrs=(size=11) name='a'; discretelegend 'a' / location=inside halign=right valign=top across=1; endlayout; endgraph; end; run; /*--Create graph with assigned group index--*/ ods listing style=colors gpath=&gpath image_dpi=&dpi; ods graphics / reset width=4in height=2.5in imagename='ModStyle4'; proc sgrender data=cars template=index; run;