/***************************************************************************************************************** SAS file name: Discrete_Attr_Map.sas File location: _________________________________________________________________________________________________________________ Purpose: To demonstrate the features of the discrete attribute map and how to use it in PROC SGPLOT Author: Peter Clemmensen Creation Date: 01/09/2017 This program supports the blog post "Discrete Attribute Maps in SAS" on SASnrd.com *****************************************************************************************************************/ /* Naive approach with STYLEATTRS */ title "Scatter plot without attribute map"; proc sgplot data=sashelp.class; styleattrs datacontrastcolors=(red blue); scatter x=height y=weight / group=sex; run; title; /* Create discrete attribute map */ data MyAttrMap; length id $4 value $1 markercolor $10 markersymbol $12; input id value markercolor markersymbol markersize; datalines; MyID M lightblue starfilled 10 MyID F lightred squarefilled 10 ; /* Print attribute map */ proc print data=MyAttrMap;run; /* Use the attribute map in PROC SGPLOT */ title "Using a discrete attribute map in PROC SGPLOT"; proc sgplot data=sashelp.class dattrmap=MyAttrMap; scatter x=height y=weight / group=sex attrid=MyID; run; title;