SGPLOT Procedure

Example 2: Clustering a Grouped Scatter Plot

Features:

SCATTER statement

GROUPDISPLAY option

CLUSTERWIDTH option

Sample library member: SGPLCLU
This example shows a simple scatter plot with grouped data that is clustered.

Output

SGPLCLU

Program

proc sgplot data=sashelp.revhub2;
  scatter x=hub y=revenue / 
    group=type groupdisplay=cluster clusterwidth=0.5;
  xaxis type=discrete;
run;

Program Description

Create the scatter plot. In the SCATTER statement, the GROUP= option groups the data by the TYPE variable. The GROUPDISPLAY option specifies that the grouped markers are clustered. The CLUSTERWIDTH option specifies the width of the group clusters.
proc sgplot data=sashelp.revhub2;
  scatter x=hub y=revenue / 
    group=type groupdisplay=cluster clusterwidth=0.5;
  xaxis type=discrete;
run;