SGPANEL Procedure

Overview: SGPANEL Procedure

The SGPANEL procedure creates a panel of graph cells for the values of one or more classification variables. For example, if a data set contains three variables (A, B and C) and you want to compare the scatter plots of B*C for each value of A, then you can use the SGPANEL to create this panel. The SGPANEL procedure creates a layout for you automatically and splits the panel into multiple graphs if necessary.
The SGPANEL procedure can create a wide variety of plot types, and overlay multiple plots together in each graph cell in the panel. It can also produce several types of layout.
Here are some examples of panels that the SGPANEL procedure can create.
Examples of Panels That Can Be Generated by the SGPANEL Procedure
Loess Curves
The following code creates a panel of loess curves:
title1 "Cholesterol Levels for Age > 60";
proc sgpanel data=sashelp.heart(
    where=(AgeAtStart > 60)) ;
  panelby sex / novarname;
  loess x=weight y=cholesterol / clm;
Vertical Bar Charts
The following code creates a panel of vertical bar charts:
title1 "Product Sales";
proc sgpanel data=sashelp.prdsale;
  panelby quarter;
  rowaxis label="Sales";
  vbar product / response=predict stat=mean
  vbar product / response=actual stat=mean
                 barwidth=0.5 transparency=0.3;
Box Plots
The following code creates a panel of box plots in a lattice layout:
title1 "Distribution of Cholesterol Levels";
proc sgpanel data=sashelp.heart;
  panelby weight_status sex / layout=lattice
  hbox cholesterol;
Histogram and Density Plots
The following code creates a panel of cells with a histogram and a normal density curve:
Title1 "Weight Distribution in the Heart Study";
proc sgpanel data=sashelp.heart noautolegend;
  panelby sex / novarname;
  histogram weight;
  density weight;