Short Run Control Chart (Example 2)

 /****************************************************************/
 /*          S A S   S A M P L E   L I B R A R Y                 */
 /*                                                              */
 /*    NAME: SHWSHRT2                                            */
 /*   TITLE: Short Run Control Chart (Example 2)                 */
 /* 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                               */
 /*                                                              */
 /*    MISC: The sample shows how to do a short run control      */
 /*          chart using the TRENDVAR= option.                   */
 /*                                                              */
 /****************************************************************/
options ps=60 ls=80 nodate;

data shortrun;
   length pcolor $ 8;
   input sample groupnum $ length @@;
   if groupnum = 'A' then do;
      nominal = 60;
      pcolor = 'yellow';
      end;
   else do;
      nominal = 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' ;
symbol v=dot c=white h=.75;

proc shewhart data=shortrun;
   xchart length * sample (groupnum) /
      cframe    = gray
      cinfill   = blue
      cblockvar = pcolor
      split     = '/'
      notrendconnect
      ypct1     = 65
      novangle
      nolegend
      trendvar  = nominal;
label sample   = 'Sample Number'
      length   = 'Average Length in mm/Nominal'
      groupnum = 'Group:';
run;

goptions reset=all;