The example
in this section uses the LAYOUT DATAPANEL statement to specify a list
of two classification variables: DIVISION (two distinct values) and
PRODUCT (three distinct values). Six combinations (crossings) of these
unique values are possible, which produces a panel with six cells.
Notice
the following details about the LAYOUT DATAPANEL statement:
-
The CLASSVARS= option on the LAYOUT
DATAPANEL statement can specify a list of one or more classifiers.
-
In the resulting graph, the data
crossings are identified by the cell headers.
proc template;
define statgraph datapanel_intro;
begingraph;
entrytitle "Office Furniture Sales";
layout datapanel classvars=(product division) / columns=2;
layout prototype;
seriesplot x=month y=actual;
endlayout;
endlayout;
endgraph;
end;
run;
In the
template code, notice the LAYOUT PROTOTYPE block, which is inside
the LAYOUT DATAPANEL block. This nested block, a required part of
the DATAPANEL layout, defines the graphical content of all of the
cells. The COLUMNS=2 setting forces a DATAPANEL layout to display
the cells in a two-column organization. The actual number of rows
that are generated depends on the number of crossings that are in
the data.
For some
data, the number of data crossings can be quite large. Thus, when
rendering the graph for a classification panel, it is common to use
a WHERE expression to limit the number of crossings:
proc sgrender data=sashelp.prdsale template=datapanel_intro;
where country="U.S.A." and region="EAST" and
product in ("CHAIR" "DESK" "TABLE") ;
format actual dollar.;
run;
The following
schematic shows the general organization of a graph that is produced
with the DATAPANEL layout. If the template code does not use the sidebar
areas that are shown in the schematic, that space is reclaimed in
the graph. Also, the order in which you specify the classification
variables affects the cell ordering. The graph that is represented
by the schematic could be produced with
CLASSVARS=(classvar1
classvar2)
.