The LAYOUT REGION Statement

The LAYOUT REGION statement supports plots that have no axes, such as pie charts. It also supports annotations such as text, lines, arrows, images, and geometric shapes, that are generated with the draw statements. For information about adding annotations, see Adding Non-Data-Driven Graphics Elements to a Graph. The LAYOUT REGION statement allows only one plot statement. If you include more than one, the additional plot statements are ignored. You can include DISCRETELEGEND, CONTINUOUSLEGEND, and ENTRY statements with your region plot statement. You can use a LAYOUT REGION statement to define a top-level region container or to define a region container for a single cell in a LAYOUT GRIDDED or LAYOUT LATTICE statement. You can also nest a REGION layout in other layouts, such as GRIDDED, LATTICE, and overlay-type layouts. However, the REGION layout cannot be nested in DATAPANEL and DATALATTICE layouts.
Note: When you nest a REGION layout in an overlay-type layout, you must include the HEIGHT=, WIDTH=, VALIGN=, and HALIGN= options in your LAYOUT REGION statement to specify the size and alignment of the plot.
Here is an example of a LAYOUT REGION statement that defines a top-level container for the pie chart that is shown in the following figure.
A Pie Chart in a Top-Level REGION Layout Container
Here is the SAS code that generates this chart.
proc template;
define statgraph region;
  begingraph;
     entrytitle "Sales By State";
     layout region;
        piechart category=state response=actual /
           dataskin=pressed datalabellocation=outside;
     endlayout;
  endgraph;
end;
run;
quit;

ods graphics on / reset outputfmt=static;

proc sgrender data=sashelp.prdsal2 template=region;
   where country eq "U.S.A.";
   format actual dollar12.0;
run;
quit;
Here is an example of a LAYOUT OVERLAY and a LAYOUT REGION statement that are nested in a LAYOUT LATTICE block to create the charts shown in the following figure.
Grid of Bar Chart and Pie Chart
Here is the SAS code that generates these charts.
/* Get sales data in millions from SASHELP.PRDSAL2. */
data sales;
   set sashelp.prdsal2;
   actualmils=(actual / 1000000);
run;

/* Create the graph template. */
proc template;
define statgraph region;
  begingraph;
     entrytitle "Sales By State";
     layout gridded / columns=1 rows=2;
        layout lattice / columns=2 rows=1;
           cell;
              /* Generate a bar chart of sales in millions. */
              cellheader;
                 entry "Sales in Millions";
              endcellheader;
              layout overlay / width=250px
                 xaxisopts=(display=none)
                 yaxisopts=(griddisplay=on display=(ticks tickvalues));
                 barchart x=state y=actualmils / 
                    group=state
                    orient=vertical
                    dataskin=pressed barwidth=0.8;  
              endlayout;
           endcell;

           cell;
              /* Generate a pie chart of percent of total sales. */
              cellheader;
                 entry "Percent of Total Sales";
              endcellheader;
              layout region / pad=10;
                piechart category=state response=actualmils /
                   name="salespct"
                   dataskin=pressed
                   datalabelcontent=(percent)
                   datalabellocation=inside labelfitpolicy=drop;
              endlayout;
           endcell;
        endlayout;
        discretelegend "salespct" / title="State" across=4;
     endlayout;
  endgraph;
end;
run;
quit;

/* Generate the graph. */
proc sgrender data=sales template=region;
   where country eq "U.S.A.";
   format actualmils dollar5.1;
run;
quit;
Notice that the LAYOUT OVERLAY statement defines the layout for the bar chart in the first cell in the lattice, and that the LAYOUT REGION statement defines the layout for the pie chart in the second cell. You can use the LAYOUT REGION statement with other layout statements to combine region plots and other types of plots in a single LAYOUT GRIDDED or LAYOUT LATTICE statement.