Formatting Values and Customizing Labels

[See CAPINS1 in the SAS/QC Sample Library]By default, each inset statistic is identified with an appropriate label, and each numeric value is printed using an appropriate format. However, you may want to provide your own labels and formats. For example, in Figure 5.17 the default format for the standard deviation prints an excessive number of decimal places. The following statements correct this problem, as well as customizing some of the labels displayed in the inset:

ods graphics on;
proc capability data=Wire noprint;
   spec lsl=22 usl=38;
   histogram Strength;
   inset n='Sample Size' min max mean std='Std Dev' (5.2);
run;

The ODS GRAPHICS ON statement specified before the PROC CAPABILITY statement enables ODS Graphics, so the histogram is created using ODS Graphics instead of traditional graphics.

The resulting histogram is displayed in Figure 5.18. You can provide your own label by specifying the keyword for that statistic followed by an equal sign (=) and the label in quotes. The label can have up to 24 characters.

The format 5.2 specified in parentheses after the keyword STD displays the standard deviation with a field width of five and two decimal places. In general, you can specify any numeric SAS format in parentheses after an inset keyword. You can also specify a format to be used for all the statistics in the INSET statement with the FORMAT= option (see the next section, Adding a Header and Positioning the Inset). For more information about SAS formats, refer to SAS Formats and Informats: Reference.

Note that if you specify both a label and a format for a statistic, the label must appear before the format, as with the keyword STD in the previous statements.

Figure 5.18 Formatting Values and Customizing Labels in an Inset
Formatting Values and Customizing Labels in an Inset