Resources

Range Chart (R Chart) Examples

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

data Disks;
   input Lot @;
   do i=1 to 6;
      input Time @;
      output;
   end;
   drop i;
   datalines;
  1 8.05 7.90 8.04 8.06 8.01 7.99
  2 8.03 8.06 8.02 8.02 7.97 8.03
  3 8.00 7.94 7.97 7.95 8.00 8.01
  4 8.00 8.06 8.06 7.99 7.97 7.96
  5 7.93 8.01 8.00 8.09 8.06 8.02
  6 7.98 7.99 8.01 8.09 8.00 7.97
  7 8.00 7.94 7.93 8.03 7.93 8.08
  8 8.01 7.98 7.98 8.07 8.05 8.09
  9 7.97 7.96 8.01 8.11 8.06 8.07
 10 7.93 8.03 8.03 8.00 7.93 8.03
 11 8.00 8.00 8.02 7.92 7.98 8.01
 12 7.98 7.93 8.01 7.97 8.02 8.00
 13 8.06 7.93 7.98 7.98 8.02 7.96
 14 8.05 7.98 8.05 7.99 7.95 7.99
 15 7.94 8.01 7.97 8.04 7.91 8.03
 16 8.03 8.03 8.02 8.06 8.00 7.97
 17 8.03 7.94 8.05 8.05 8.04 7.94
 18 7.99 7.99 7.86 7.99 8.06 8.03
 19 7.95 7.96 7.99 7.96 7.94 8.12
 20 8.03 8.07 7.98 7.97 8.00 8.04
 21 8.04 7.90 8.03 8.02 7.98 7.97
 22 7.95 8.05 7.98 8.01 7.97 8.15
 23 8.06 8.00 8.03 8.02 7.99 7.95
 24 7.97 8.02 8.00 7.96 7.96 8.00
 25 8.12 7.97 7.99 8.09 8.05 8.00
;


title 'The Data Set DISKS';
proc print data=Disks(obs=18) noobs;
run;

ods graphics off;
title 'Range Chart for Disk Drive Test Times';
proc shewhart data=Disks;
   rchart Time*Lot;
run;

data Disksum;
   input Lot TimeX TimeR;
   TimeN=6;
   datalines;
  1  8.00833  0.16
  2  8.02167  0.09
  3  7.97833  0.07
  4  8.00667  0.10
  5  8.01833  0.16
  6  8.00667  0.12
  7  7.98500  0.15
  8  8.03000  0.11
  9  8.03000  0.15
 10  7.99167  0.10
 11  7.98833  0.10
 12  7.98500  0.09
 13  7.98833  0.13
 14  8.00167  0.10
 15  7.98333  0.13
 16  8.01833  0.09
 17  8.00833  0.11
 18  7.98667  0.20
 19  7.98667  0.18
 20  8.01500  0.10
 21  7.99000  0.14
 22  8.01833  0.20
 23  8.00833  0.11
 24  7.98500  0.06
 25  8.03667  0.15
;

title 'The Summary Data Set of Disk Drive Test Times';
proc print data=Disksum(obs=5) noobs;
run;

options nogstyle;
goptions ftext=swiss;
symbol color = rose h = .8;
title 'Range Chart for Disk Drive Test Times';
proc shewhart history=Disksum;
   rchart Time*Lot / cframe   = vipb
                     cinfill  = ywh
                     cconnect = rose;
run;
options gstyle;

proc shewhart data=Disks;
   rchart Time*Lot / outhistory = Diskhist
   nochart;
run;

title 'Summary Data Set for Disk Times';
proc print data=Diskhist(obs=5) noobs;
run;

title 'Control Limits for Disk Times';
proc shewhart data=Disks;
   rchart Time*Lot / outlimits = Disklim
                     nochart;
run;

title 'Control Limits for Disk Times';
proc print data=Disklim noobs;
run;

title 'Summary Statistics and Control Limit Information';
proc shewhart data=Disks;
  rchart Time*Lot / outtable=Disktab
                    nochart;
run;

title 'Summary Statistics and Control Limit Information';
proc print data=Disktab noobs;
run;

title 'Range Chart for Disk Drive Test Times';
proc shewhart table=Disktab;
   rchart Time*Lot;
run;

data Disks2;
   input Lot @;
   do i=1 to 6;
      input Time @;
      output;
   end;
   drop i;
   datalines;
26 7.93 7.97 7.89 7.81 7.88 7.92
27 7.86 7.91 7.87 7.89 7.83 7.87
28 7.93 7.95 7.90 7.89 7.88 7.90
29 7.97 8.00 7.86 7.89 7.84 7.78
30 7.91 7.93 7.98 7.93 7.83 7.88
31 7.85 7.94 7.88 7.98 7.96 7.84
32 7.86 8.01 7.88 7.95 7.90 7.89
33 7.87 7.93 7.96 7.89 7.81 8.00
34 7.87 7.97 7.95 7.89 7.92 7.84
35 7.92 7.97 7.90 7.88 7.89 7.86
36 7.96 7.90 7.90 7.84 7.90 8.00
37 7.92 7.90 7.98 7.92 7.94 7.94
38 7.88 7.99 8.02 7.98 7.88 7.92
39 7.89 7.91 7.92 7.90 7.94 7.94
40 7.84 7.88 7.91 7.98 7.87 7.93
41 7.91 7.87 7.96 7.91 7.89 7.92
42 7.96 7.93 7.86 7.93 7.86 7.94
43 7.84 7.82 7.87 7.91 7.91 8.01
44 7.93 7.91 7.92 7.88 7.91 7.86
45 7.95 7.92 7.93 7.90 7.86 8.00
;


ods graphics on;
title 'Range Chart for Disk Drive Test Times';
proc shewhart data=Disks2 limits=Disklim;
   rchart Time*Lot / odstitle=title;
run;