Insets Details Examples

/****************************************************************/
/*          S A S   S A M P L E   L I B R A R Y                 */
/*                                                              */
/*    NAME: SHWINGS                                             */
/*   TITLE: Insets Details Examples                             */
/* PRODUCT: QC                                                  */
/*  SYSTEM: ALL                                                 */
/*    KEYS: Shewhart Charts, Insets                             */
/*   PROCS: SHEWHART                                            */
/*    DATA:                                                     */
/*                                                              */
/*     REF: SAS/QC Software:  Usage and Reference, Version 6,   */
/*          First Edition, Volume 1 and Volume 2                */
/*                                                              */
/****************************************************************/

data Wafers;
   input Batch @;
   do i=1 to 5;
      input Diameter @;
      output;
   end;
   drop i;
   datalines;
 1  35.00 34.99 34.99 34.98 35.00
 2  35.01 34.99 34.99 34.98 35.00
 3  34.99 35.00 35.00 35.00 35.00
 4  35.01 35.00 34.99 34.99 35.00
 5  35.00 34.99 34.98 34.99 35.00
 6  34.99 34.99 35.00 35.00 35.00
 7  35.01 34.98 35.00 35.00 34.99
 8  35.00 35.00 34.99 34.98 34.99
 9  34.99 34.98 34.98 35.01 35.00
10  34.99 35.00 35.01 34.99 35.01
11  35.01 35.00 35.00 34.98 34.99
12  34.99 34.99 35.00 34.98 35.01
13  35.01 34.99 34.98 34.99 34.99
14  35.00 35.00 34.99 35.01 34.99
15  34.98 34.99 34.99 34.98 35.00
16  34.99 35.00 35.00 35.01 35.00
17  34.98 34.98 34.99 34.99 34.98
18  35.01 35.02 35.00 34.98 35.00
19  34.99 34.98 35.00 34.99 34.98
20  34.99 35.00 35.00 34.99 34.99
21  35.00 34.99 34.99 34.98 35.00
22  35.00 35.00 35.01 35.00 35.00
23  35.02 35.00 34.98 35.02 35.00
24  35.00 35.00 34.99 35.01 34.98
25  34.99 34.99 34.99 35.00 35.00
;


ods graphics off;
title 'Mean Chart for Diameters';
proc shewhart data=Wafers;
   xchart Diameter*Batch / tests= 1 to 8;
   inset ntests 1 / height=3 cfill=blank header='NW' pos=nw;
   inset ntests 2 / height=3 cfill=blank header='N ' pos=n ;
   inset ntests 3 / height=3 cfill=blank header='NE' pos=ne;
   inset ntests 4 / height=3 cfill=blank header='E ' pos=e ;
   inset ntests 5 / height=3 cfill=blank header='SE' pos=se;
   inset ntests 6 / height=3 cfill=blank header='S ' pos=s ;
   inset ntests 7 / height=3 cfill=blank header='SW' pos=sw;
   inset ntests 8 / height=3 cfill=blank header='W ' pos=w ;
run;

title 'Mean Chart for Diameters';
proc shewhart data=Wafers;
   xchart Diameter*Batch;
   inset n /
      header   = 'Position=(6,34.985)'
      position = (6,34.985) data;
run;

title 'Mean Chart for Diameters';
proc shewhart data=Wafers;
   xchart Diameter*Batch;
   inset nmin / position = (5,25)
                 header   = 'Position=(5,25)'
                 height   = 3
                 cfill    = blank
                 refpoint = tl;
   inset nmax / position = (95,95)
                 header   = 'Position=(95,95)'
                 height   = 3
                 cfill    = blank
                 refpoint = tr;
run;

data Parts;
   length Machine $ 4;
   input Sample Machine $ Day Shift DiamX DiamS;
   DiamN=6;
   datalines;
 1  A386  01  1  4.32  0.39
 2  A386  01  2  4.49  0.35
 3  A386  01  3  4.44  0.44
 4  A386  02  1  4.45  0.17
 5  A386  02  2  4.21  0.53
 6  A386  02  3  4.56  0.26
 7  A386  03  1  4.63  0.39
 8  A386  03  2  4.38  0.47
 9  A386  03  3  4.47  0.40
10  A455  04  1  4.42  0.37
11  A455  04  2  4.45  0.32
12  A455  04  3  4.62  0.36
13  A455  05  1  4.33  0.31
14  A455  05  2  4.29  0.33
15  A455  05  3  4.17  0.25
16  C334  08  1  4.15  0.28
17  C334  08  2  4.21  0.33
18  C334  08  3  4.16  0.19
19  C334  09  1  4.14  0.13
20  C334  09  2  4.11  0.19
21  C334  09  3  4.10  0.27
22  C334  10  1  3.99  0.14
23  C334  10  2  4.24  0.16
24  C334  10  3  4.23  0.14
25  A386  11  1  4.27  0.28
26  A386  11  2  4.70  0.45
27  A386  11  3  4.51  0.45
28  A386  12  1  4.34  0.16
29  A386  12  2  4.38  0.29
30  A386  12  3  4.28  0.24
31  A386  15  1  4.47  0.26
32  A386  15  2  4.31  0.46
33  A386  15  3  4.52  0.33
;