The UNIVARIATE Procedure
INSET Statement
INSET keywords </ options>;
An INSET statement places a box or table of summary statistics, called an inset, directly in a graph that is created by a CDFPLOT, HISTOGRAM, PPPLOT, PROBPLOT, or QQPLOT statement. The INSET statement must follow the plot statement that creates the plot that you want to augment. The inset appears in all the graphs that the preceding plot statement produces.
You can use multiple INSET statements after a plot statement to add more than one inset to a plot. See Example 4.17.
In an INSET statement, you specify one or more keywords that identify the information to display in the inset. The information is displayed in the order in which you specify the keywords. Keywords can be any of the following:
Statistical Keywords
The available statistical keywords are listed in Table 10.
Table 10: Statistical Keywords
To create a completely customized inset, use a DATA= data set.
Primary and Secondary Keywords
A primary keyword specifies a fitted distribution, which is one of the parametric distributions or a kernel density estimate. You specify secondary keywords in parentheses after the primary keyword to request particular statistics that are associated with that distribution.
Note: When you produce traditional graphics output, you can specify a primary keyword without secondary keywords to display a colored line and the distribution name as a key for the density curve.
In the HISTOGRAM statement, you can request more than one fitted distribution from the same family (for example, two normal distributions). You can display inset statistics for individual curves by specifying the curve indices in square brackets immediately following the primary keyword.
The following statements produce a histogram that has three fitted normal curves and an inset that contains goodness-of-fit statistics for the second curve only:
proc univariate data=score;
histogram final / normal(sigma=1 2 3);
inset normal[2](ad adpval);
run;
Table 11 lists the primary keywords and the plot statements with which they can be specified.
Table 11: Primary Keywords
Table 12 lists the secondary keywords available with the primary keywords listed in Table 11.
Table 12: Secondary Keywords
The inset statistics listed in Table 12 are not available unless you request a plot statement and options that calculate these statistics. For example, consider the following statements:
proc univariate data=score;
histogram final / normal;
inset mean std normal(ad adpval);
run;
The MEAN and STD keywords display the sample mean and standard deviation, respectively, of final. The NORMAL keyword with the secondary keywords AD and ADPVAL displays the Anderson-Darling goodness-of-fit test statistic and p-value, respectively. The statistics that are specified with the NORMAL keyword are available only because the NORMAL option is requested in the HISTOGRAM statement.
The KERNEL keyword is available only if you request a kernel density estimate in a HISTOGRAM statement. The WEIBULL2 keyword is available only if you request a two-parameter Weibull distribution in the PROBPLOT or QQPLOT statement.
INSET Statistic Labels and Formats
By default, PROC UNIVARIATE identifies inset statistics with appropriate labels and prints numeric values with appropriate formats. To customize the label, specify the keyword followed by an equal sign (=) and the desired label in quotes. To customize the format, specify a numeric format in parentheses after the keyword. Labels can have up to 24 characters. If you specify both a label and a format for a statistic, the label must appear before the format. For example, the following statement requests customized labels for two statistics and displays the standard deviation with a field width of 5 and two decimal places:
inset n='Sample Size' std='Std Dev' (5.2);
Summary of Options
Table 13 lists INSET statement options, which you can specify after the slash (/) in the INSET statement. For complete descriptions, see the section Dictionary of Options.
Table 13: INSET Options
| Option | Description |
|---|---|
| CFILL=color | BLANK | Specifies color of inset background |
| CFILLH=color | Specifies color of header background |
| CFRAME=color | Specifies color of frame |
| CHEADER=color | Specifies color of header text |
| CSHADOW=color | Specifies color of drop shadow |
| CTEXT=color | Specifies color of inset text |
| DATA | Specifies data units for POSITION= |
| FONT=font | Specifies font of text |
| FORMAT=format | Specifies format of values in inset |
| GUTTER=value | Specifies gutter width for inset in top or bottom margin |
| HEADER='string' | Specifies header text |
| HEIGHT=value | Specifies height of inset text |
| NCOLS= | Specifies number of columns for inset in top or bottom margin |
| NOFRAME | Suppresses frame around inset |
| POSITION=position | Specifies position of inset |
| REFPOINT=BL | BR | TL | TR | Specifies reference point of inset positioned with POSITION= |
Dictionary of Options
The following entries provide detailed descriptions of the options you can specify in the INSET statement. Options marked with † apply only when traditional graphics are produced.