Inset with User Specified Labels & Formats

 /****************************************************************/
 /*          S A S   S A M P L E   L I B R A R Y                 */
 /*                                                              */
 /*    NAME: CAPILAB                                             */
 /*   TITLE: Inset with User Specified Labels & Formats          */
 /* PRODUCT: QC                                                  */
 /*  SYSTEM: ALL                                                 */
 /*    KEYS: Capability Analysis, Insets,                        */
 /*   PROCS: CAPABILITY                                          */
 /*    DATA:                                                     */
 /*                                                              */
 /*     REF:                                                     */
 /*    MISC:                                                     */
 /*                                                              */
 /****************************************************************/

options ps=60 ls=80;


data boxes;
   label weight='Weight in Grams';
   input weight @@;
   cards;
30.26 31.23 71.96 47.39 33.93 76.15 42.21
81.37 78.48 72.65 61.63 34.90 24.83 68.93
43.27 41.76 57.24 23.80 34.03 33.38 21.87
31.29 32.48 51.54 44.06 42.66 47.98 33.73
25.80 29.95 60.89 55.33 39.44 34.50 73.51
43.41 54.67 99.43 50.76 48.81 31.86 33.88
35.57 60.41 54.92 35.66 59.30 41.96 45.32
;

Title 'Labels and Formats in the INSET Statement';

 /*--------------------------------------------*/
 /* User-Specified Labels for INSET Statistics */
 /*--------------------------------------------*/

proc capability data=boxes noprint;
   var weight;
   hist / cframe   = gray
          cfill    = blue
          cbarline = white;
   inset mean = 'Mean Weight'
         std  = 'Std of Weight'
         max  = 'Maximum Weight'
         min  = 'Minimum Weight'
                          / header = 'Summary Statistics'
                            cframe = white
                            ctext  = white
                            cfill  = blue
                            pos    = NE;
run;

 /*--- User-Specified Formats for INSET Statistics ---*/

 /*-----------------------------------------------*/
 /* You can specify the format in parentheses...  */
 /*-----------------------------------------------*/

proc capability data=boxes noprint;
   var weight;
   hist / cframe   = gray
          cfill    = green
          cbarline = white;
   inset mean (6.2)
         std  (6.2)
         max  (5.1)
         min  (5.1)       / header = 'Summary Statistics'
                            cframe = white
                            ctext  = white
                            cfill  = green
                            pos    = NE;
run;

 /*--------------------------------------------------------*/
 /* ...or use the FORMAT= option to format all statistics. */
 /*--------------------------------------------------------*/

proc capability data=boxes noprint;
   var weight;
   hist / cframe   = gray
          cfill    = yellow
          cbarline = black;
   inset mean std max min
                          / header = 'Summary Statistics'
                            cframe = black
                            ctext  = black
                            format = 6.2
                            cfill  = yellow
                            pos    = NE;
run;

 /*---------------------------------------------*/
 /* Combining user-specified labels and formats */
 /*---------------------------------------------*/

proc capability data=boxes noprint;
   var weight;
   hist / cframe   = gray
          cfill    = red
          cbarline = white;
   inset mean = 'Mean Weight'    (6.2)
         std  = 'Std of Weight'  (6.2)
         max  = 'Maximum Weight' (5.1)
         min  = 'Minimum Weight' (5.1)
                          / header = 'Summary Statistics'
                            cframe = white
                            ctext  = white
                            format = 6.2
                            cfill  = red
                            pos    = NE;
run;

goptions reset=all;