Machine Study with Comparative Histogram

/****************************************************************/
/*          S A S   S A M P L E   L I B R A R Y                 */
/*                                                              */
/*    NAME: CAPCMH2                                             */
/*   TITLE: Machine Study with Comparative Histogram            */
/* PRODUCT: QC                                                  */
/*  SYSTEM: ALL                                                 */
/*    KEYS: Capability Analysis, Comparative Histogram,         */
/*   PROCS: CAPABILITY                                          */
/*    DATA:                                                     */
/*                                                              */
/* SUPPORT: saswgr                                              */
/*     REF: SAS/QC Software:  Usage and Reference, Version 6,   */
/*          First Edition, Volume 1 and Volume 2                */
/*    MISC:                                                     */
/*                                                              */
/****************************************************************/

data Machines;
   input position @@;
   label position='Position in Millimeters';
   if      (_n_ <= 100) then Machine = 'Machine 1';
   else if (_n_ <= 200) then Machine = 'Machine 2';
   else                      Machine = 'Machine 3';
   datalines;
-0.17  -0.19  -0.24  -0.24  -0.12   0.07  -0.61   0.22   1.91  -0.08
-0.59   0.05  -0.38   0.82  -0.14   0.32   0.12  -0.02   0.26   0.19
-0.07   0.13  -0.49   0.07   0.65   0.94  -0.51  -0.61  -0.57  -0.51
 0.01  -0.51   0.07  -0.16  -0.32  -0.42  -0.42  -0.34  -0.34  -0.35
-0.49   0.11  -0.42   0.76   0.02  -0.59  -0.28   1.12  -0.02  -0.60
-0.64   0.13  -0.32  -0.77  -0.02  -0.07  -0.49  -0.53  -0.22   0.61
-0.23   0.02   0.53   0.23  -0.44  -0.05   0.37  -0.42   0.70  -0.35
-0.18  -0.32  -0.18   0.38  -0.01   0.17  -0.65  -0.45   0.19  -0.12
-0.30  -0.38   0.11  -0.17  -0.36  -0.65  -0.50  -0.29   0.14   0.38
 0.14  -0.07  -0.55   0.00  -0.24  -0.18   0.35  -0.30   0.98   0.63
 0.49   0.47   0.43   0.44   0.52   0.66   0.13   0.77   0.69   0.55
 0.15   0.64   0.32   1.16   0.51   0.84   0.70   0.60   0.79   0.74
 0.56   1.71   0.23   0.66   1.06   1.24   0.21   0.13   0.16   0.22
 0.62   0.22   0.66   0.49   0.37   0.29   0.29   0.36   0.35   0.35
 0.23   0.69   0.29   1.12   0.63   0.15   0.40   1.35   0.59   0.14
 0.10   0.70   0.37  -0.02   0.60   0.56   0.23   0.20   0.45   1.03
 0.44   0.63   0.98   0.77   0.28   0.58   0.87   0.29   1.09   0.35
 0.48   0.37   0.48   0.87   0.60   0.73   0.09   0.26   0.75   0.52
 0.39   0.32   0.69   0.49   0.34   0.09   0.22   0.39   0.71   0.88
 0.71   0.56   0.18   0.61   0.43   0.47   0.85   0.39   1.26   1.04
 0.59   0.57   0.53   0.53   0.62   0.75   0.14   0.84   0.77   0.65
 0.17   0.73   0.41   1.11   0.61   0.89   0.78   0.69   0.86   0.82
 0.65   0.79   0.29   0.75   1.04   1.15   0.26   0.13   0.19   0.27
 0.71   0.27   0.75   0.59   0.46   0.37   0.36   0.44   0.44   0.44
 0.29   0.77   0.37   1.08   0.72   0.17   0.49   1.21   0.69   0.15
 0.09   0.78   0.46  -0.13   0.69   0.66   0.29   0.25   0.54   1.03
 0.53   0.72   0.99   0.84   0.35   0.67   0.91   0.36   1.06   0.44
 0.58   0.46   0.58   0.92   0.70   0.81   0.07   0.33   0.82   0.62
 0.48   0.41   0.78   0.58   0.43   0.07   0.27   0.49   0.79   0.92
 0.79   0.66   0.22   0.71   0.53   0.57   0.90   0.48   1.17   1.03
;

data speclims;
   input Machine $9. _lsl_ _usl_;
   _var_ = 'position';
   datalines;
Machine 1 -0.5 0.5
Machine 2  0.0 1.0
Machine 3  0.0 1.0
;

proc capability data=Machines noprint;
   spec cleft cright;
   comphist position / class      = Machine
                       nrows      = 3
                       intertile  = 1
                       midpoints  = -1.2 to 2.2 by 0.1
                       kernel(fill)
                       classspecs = speclims;
   inset mean std="Std Dev" / pos = ne format = 6.3;
run;