The PARETO Procedure

INSET Statement

INSET keyword-list </ options> ;

The INSET statement enables you to enhance a Pareto chart by adding a box or table (called an inset) of summary statistics directly to the graph. An inset can display statistics that are calculated by the PARETO procedure or arbitrary values that are provided in a SAS data set.

An INSET statement must follow a chart statement, and it produces an inset on that chart. More than one INSET statement can apply to the same chart statement. When the chart statement produces a comparative chart, an associated INSET statement produces an inset in every cell of the chart. Statistics that are displayed in the inset of a cell are computed from the data that are associated with that cell.

Note: When ODS Graphics is enabled, only one INSET statement can be associated with a comparative Pareto chart. Insets are not available with legacy line printer charts, so the INSET statement is not applicable when you specify the LINEPRINTER option in the PROC PARETO statement.

The keyword-list can include any of the keywords listed in Table 15.4. Statistics are displayed in the order in which the keywords are specified. Each keyword-list entry has the following form:

keyword <='label'> <(format)>

By default, inset statistics are identified with appropriate labels, and numeric values are printed using appropriate formats. However, you can provide customized labels and formats. You provide a customized label by specifying the keyword for that statistic followed by an equal sign (=) and the label in quotation marks. Labels can have up to 24 characters. You provide the numeric format in parentheses after the keyword. If you specify both a label and a format for a statistic, the label must appear before the format. See Example 15.10.

Note the difference between keywords and options: keywords specify the information to be displayed in an inset, whereas options control the appearance of the inset. You can use options in the INSET statement to do the following:

  • specify the position of the inset

  • specify a header for the inset

  • specify enhancements for traditional graphics, such as background colors, text colors, text height, text font, and drop shadows

Table 15.5 lists available INSET statement options.

The following statements produce a vertical Pareto chart with insets in the upper left (northwest) and upper right (northeast) corners, and a horizontal comparative Pareto chart with insets in each cell.

proc pareto data=Failure3;
   vbar Cause / maxncat = 5 other = 'Others';
      inset nothercat / position = nw;
      inset nother / position = ne;
   hbar Cause / class = Stage;
      inset n;
run;

INSET Statement Keywords

Table 15.4 lists the keywords available in the INSET statement.

Table 15.4: INSET Statement Keywords

Keyword

Description

DATA=SAS-data-set

Reads (label, value) pairs from a SAS data set

N

Specifies the sample size

NEXCL

Specifies the number of observations excluded from a restricted Pareto chart

NOTHER

Specifies the number of observations in the OTHER= category

NOTHERCAT

Specifies the number of categories merged to form the OTHER= category

SUMWGTS

Specifies the sum of weighted frequencies across all categories


The NOTHERCAT and NOTHER statistics are 0 if the OTHER= option is not specified. The NEXCL statistic is 0 if the OTHER= option is specified.

All INSET keywords request a single statistic in an inset, except for the DATA= keyword. The DATA= keyword specifies a SAS data set that contains (label, value) pairs to be displayed in an inset. The data set must contain the variables _LABEL_ (a character variable whose values provide labels for inset entries) and _VALUE_ (which can be character or numeric and provides values displayed in the inset). The label and value from each observation in the DATA= data set occupy one line in the inset. Example 15.11 illustrates the use of the DATA= keyword.

INSET Statement Options

Figure 15.8 illustrates the terms that are used in this section.

Figure 15.8: Inset Terms


Table 15.5 lists the options available in the INSET statement.

Table 15.5: INSET Statement Options

Keyword

Description

General Options

FORMAT=

Specifies the format for numeric values in the inset

HEADER=

Specifies the header text

NOFRAME

Suppresses the frame around the inset

POSITION=

Specifies the position of the inset

Options for ODS Graphics Output

CFILL

Specifies the color of the inset background

GUTTER=

Specifies the gutter width for an inset in the top or bottom margin

NCOLS=

Specifies the number of columns for an inset in the top or bottom margin

Options for Traditional Graphics

CFILL=

Specifies the color of the inset background

CFILLH=

Specifies the color of the header background

CFRAME=

Specifies the color of the frame

CHEADER=

Specifies the color of the header text

CSHADOW=

Specifies the color of the drop shadow

CTEXT=

Specifies the color of the inset text

DATA

Specifies that POSITION=(x,y) coordinates are in data units

FONT=

Specifies the text font

HEIGHT=

Specifies the height of the inset text

REFPOINT=

Specifies the reference point of an inset that is positioned by POSITION=(x,y) coordinates


The following entries provide detailed descriptions of options in the INSET statement.

General Options

You can specify the following options when you use either ODS Graphics or traditional graphics:

FORMAT=format

specifies a format for all the values that are displayed in an inset. If you specify a format for a particular statistic, then that format overrides the format you specify in this option.

HEADER= ’string’

specifies the header text. The string cannot exceed 40 characters. If you do not specify this option, no header line appears in the inset.

NOFRAME

suppresses the frame drawn around the inset.

POSITION=position
POS=position

determines the position of the inset. The position can be a compass point keyword (N, NE, E, SE, S, SW, W, or NW), a margin keyword (TM, RM, BM, or LM), or a pair of coordinates (x,y). You can specify coordinates in axis percentage units or axis data units. For more information, see the section Positioning Insets. By default, POSITION=NW, which positions the inset in the upper left (northwest) corner of the display.

Note: You cannot use the POSITION= option to specify coordinates when producing ODS Graphics output.

ODS Graphics Options

You can specify the following options when you use ODS Graphics:

CFILL
CFILL=BLANK

specifies the color of the inset background. If you do not specify this option, the inset background is transparent. This means that items that are overlapped by the inset (such as Pareto bars or the cumulative percentage curve) show through the inset. If you specify this option without an argument, the background is opaque and its color is specified by the Color attribute of the GraphBackground style element in the current ODS style. If you specify CFILL=BLANK, the background is opaque and its color is specified by the Color attribute of the GraphWalls style element in the current ODS style.

GUTTER=value

specifies the gutter width in screen percentage units for an inset that is located in the top or bottom margin. The gutter is the space between columns of values in an inset.

NCOLS=n

specifies the number of columns of (label, value) pairs that are displayed in an inset that is located in the top or bottom margin.

Traditional Graphics Options

You can specify the following options when you produce traditional graphics.

CFILL=color | BLANK

specifies the color of the inset background (including the header background if you do not specify the CFILLH= option). If you specify CFILL=BLANK, the background color is determined by the Color attribute of the GraphWalls style element in the current ODS style. If you do not specify this option, the inset background is transparent. This means that items overlapped by the inset (such as Pareto bars or the cumulative percentage curve) show through the inset.

CFILLH=color

specifies the color of the header background. If you do not specify this option, the CFILL= color is used.

CFRAME=color

specifies the color of the inset frame. The default color is specified by the ContrastColor attribute of the GraphBorderLines style element in the current ODS style.

CHEADER=color

specifies the color of the header text. If you do not specify this option, the CTEXT= color is used.

CSHADOW=color
CS=color

specifies the color of the drop shadow. See Output 15.11.1 for an example. If you do not specify this option, a drop shadow is not displayed.

CTEXT=color
CT=color

specifies the color of the text. The default color is specified by the Color attribute of the GraphValueText style element in the current ODS style.

DATA

specifies that data coordinates be used in positioning the inset with the POSITION= option. You can specify this option only when you specify POSITION=(x,y), and you must include it immediately after the coordinates (x,y). For more information, see the section Using Coordinates to Position Insets. See Figure 15.11 for an example.

FONT=font

specifies the font of the text. The default font is determined by the FontFamily, FontStyle, and FontWeight attributes of the GraphValueText style element in the current ODS style.

HEIGHT=value

specifies the height of the text in the inset. The default value is specified by the FontSize attribute of the GraphValueText style element in the current ODS style.

REFPOINT=BR | BL | TR | TL
RP=BR | BL | TR | TL

specifies the reference point for an inset that is positioned by a pair of coordinates (x,y), which are specified in the POSITION= option. The REFPOINT= option specifies which corner of the inset frame you want positioned at coordinates (x,y). The keywords BL, BR, TL, and TR represent bottom left, bottom right, top left, and top right, respectively. See Figure 15.12 for an example. By default, REFPOINT=BL.

If you specify the position of the inset as a compass point or margin keyword, this option is ignored. For more information, see Using Coordinates to Position Insets.