Modify the Procedure to Use the SG Attribute Map Data Set

After you have created an SG attribute map data set, you can modify the SG procedure and its plot statements to reference the SG attribute map data. You can use attribute maps in the SGPLOT, SGPANEL, and SGSCATTER procedures.
To reference attribute map data in a procedure:
  1. Add the DATTRMAP= option to the procedure statement and specify the name of the SG attribute map data set.
  2. For each plot statement that maps attributes, perform these steps:
    • Specify the GROUP= option. The group’s values must correspond to the values in the VALUE variable in the attribute map data set.
    • Specify the ATTRID= option. This option specifies the value of the ID variable in the SG attribute map data set.
      If the SG attribute map data set contains more than one ID value, then the plot statements can specify different ATTRID values. However, plots that specify different ATTRID values must also specify different groups. A group variable can be associated with only one attribute map ID. For more information, see Data Sets That Contain Multiple SG Attribute Maps.
      If the ATTRID value that you specify does not match a value for the ID variable in the attribute map data set, a warning is written to the SAS log and the ATTRID is ignored.
Attribute mapping is supported in the PLOT statement of the SGSCATTER procedure.
In the SGPLOT and SGPANEL procedures, any plot statement that supports GROUP variables supports attribute mapping. In these procedures, all plot statements support attribute mapping except the following:
SGPANEL and SGPLOT Statements That Do Not Support Attribute Mapping
SGPANEL
SGPLOT
DENSITY
HISTOGRAM
KEYLEGEND
REFLINE
DENSITY
ELLIPSE
HISTOGRAM
INSET
KEYLEGEND
REFLINE
Here is an example of an SGPLOT procedure that references the SG attribute map data set shown in the example Listing of the SG Attribute Map Data Set MYATTRMAP. The options that reference the attribute map (data set and ID) are highlighted.
proc sgplot data=sashelp.class dattrmap=myattrmap;
vbar age / response=height group=sex groupdisplay=cluster attrid=myid;
run;