Short Run Control Chart (Example 1)

 /****************************************************************/
 /*          S A S   S A M P L E   L I B R A R Y                 */
 /*                                                              */
 /*    NAME: SHWSHRT1                                            */
 /*   TITLE: Short Run Control Chart (Example 1)                 */
 /* PRODUCT: QC                                                  */
 /*  SYSTEM: ALL                                                 */
 /*    KEYS: Shewhart Charts, Short Run Process Control,         */
 /*   PROCS: SHEWHART                                            */
 /*    DATA:                                                     */
 /*                                                              */
 /*    REF:  Example is based on Short Run Illustration from     */
 /*          Montgomery, "Introduction to Statistical Quality    */
 /*          Control", 2nd Edition                               */
 /*                                                              */
 /****************************************************************/
 options ps=60 ls=80 nodate;

data shortrun;
   length pcolor $ 8;
   input sample groupnum $ length @@;
   if groupnum = 'A' then do;
      length = length - 60;
      pcolor = 'yellow';
      end;
   else do;
      length = length - 20;
      pcolor = 'red';
      end;
cards;
1 A 60  1 A 61  1 A 62   2 A 59  2 A 60  2 A 61
3 A 58  3 A 59  3 A 62   4 A 59  4 A 63  4 A 61
5 B 21  5 B 17  5 B 22   6 B 19  6 B 20  6 B 18
7 B 19  7 B 20  7 B 21   8 B 18  8 B 22  8 B 22
9 B 18  9 B 18  9 B 17  10 B 20 10 B 21 10 B 20
;

title  'Short Run Control Chart' ;

symbol1 v=dot h=.75 c=white;
proc shewhart data=shortrun;
   xrchart length * sample (groupnum) /
      cframe    = gray
      cinfill   = blue
      cblockvar = pcolor
      split     = '/'
      notrendconnect
      ypct1     = 65
      novangle
      nolegend;
label sample   = 'Sample Number'
      length   = 'Average Length in mm/Range'
      groupnum = 'Group:';
run;

goptions reset=all;