SAS Institute. The Power to Know

SAS/GRAPH(R) 9.2: Graph Template Language Reference

Previous | Next
LAYOUT DATAPANEL Statement

Example Program and Statement Details

The following graph was generated by the "Example Program":


layoutdatapanelintro image

Example Program

This example shows a four-column, three-row data panel using two classification variables. With this layout, each data cell is subsetted and labeled with the values of the classification variables.
  • The ROWDATARANGE = UNION option assures that an axis range is computed separately for each row using the data ranges of all Y= variables in that row. This facilitates the visual comparison of the data cells.
  • A SIDEBAR block is used to place the legend at the bottom of the lattice.
  
 proc template; 
  define statgraph layoutdatapanel; 
   begingraph; 
     entrytitle "Annual Furniture Sales Comparisons"; 
     layout datapanel classvars=(country year) / 
       columns=4 rows=3 rowdatarange=union 
       headerlabeldisplay=value 
       headerbackgroundcolor=GraphAltBlock:color 
       rowaxisopts=(display=(tickvalues) griddisplay=on 
         linearopts=(tickvalueformat=dollar12.)) 
       columnaxisopts=(display=(tickvalues) 
         timeopts=(tickvalueformat=monname3.)); 
       layout prototype / cycleattrs=true; 
         seriesplot x=month y=TotalActual / name="Actual"; 
         seriesplot x=month y=TotalPredict / name="Predict"; 
       endlayout; 
       sidebar / align=top; 
         discretelegend "Actual" "Predict" / border=false; 
       endsidebar; 
     endlayout; 
   endgraph; 
  end; 
 run; 
  
 proc summary data=sashelp.prdsal2 nway; 
   class country year month; 
   var actual predict; 
   output out=prdsal2 sum=TotalActual TotalPredict; 
 run; 
  
 proc sgrender data=prdsal2 template=layoutdatapanel; 
 run;
 

Statement Summary

The LAYOUT DATAPANEL statement creates a grid of graphs, based on the values of one or more classifications variables. The main differences between this layout and the DATALATTICE layout is that this layout supports more than two classification variables, and it provides more control over the grid layout.

By default, the number of cells in the layout is determined by a cross-tabulation table of all the classification variables plus any empty cells needed to complete the last row/column of the grid. The contents of each data cell are based on a graph prototype that you specify in the graph-prototype-block . Optionally, you can enhance the display using one or more sidebar-statement-blocks . For classification variables that have many values, you can use the COLUMNS= and/or ROWS= options with the PANELNUMBER= option to generate multiple panel displays.

The order of the value pairings for the classification variables is determined by the order that the variables are specified on the CLASSVARS= argument, with the last named variable's values varying most rapidly (like nested DO loops). Variable values are always returned in data order.

By default, the first data cell to be filled is in the layout's top-left corner, and data cells are filled from left-to-right, top-to-bottom. Use the START= option to change the starting data cell to the bottom-left corner, and use the ORDER= option to determine whether data cells fill by column or by row. See the START= option for illustrations on how START= and ORDER= interact to manage the fill sequence for data cells.

Note: The DATAPANEL layout is designed to be the outermost layout in the template.


Required Argument

Prototype Block

Sidebar Blocks

Options

Previous | Next | Top of Page