c Chart Examples

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


data Trucks;
   input TruckID $ Defects @@;
   label TruckID='Truck Identification Number'
         Defects='Number of Paint Defects';
   datalines;
C1   5   C2   4   C3   4   C4   8   C5  7
C6  12   C7   3   C8  11   E4   8   E9  4
E7   9   E6  13   A3   5   A4   4   A7  9
Q1  15   Q2   8   Q3   9   Q9  10   Q4  8
;


title 'Paint Defects on New Trucks';
proc print data=Trucks(obs=5) noobs;
run;

ods graphics off;
title 'c Chart for Paint Defects on New Trucks';
proc shewhart data=Trucks;
   cchart Defects*TruckID;
run;

proc shewhart data=Trucks;
   cchart Defects*TruckID / outlimits=Deflim
                            nochart;
run;

title 'Control Limits Data Set Deflim';
proc print data=Deflim noobs;
run;

title 'Number of Nonconformities and Control Limit Information';
proc shewhart data=Trucks;
   cchart Defects*TruckID / outtable=Trucktab
                            nochart;
run;

title 'Number of Nonconformities and Control Limit Information';
proc print data=Trucktab noobs;
run;

data Trucks2;
   input TruckID $ Defects @@;
   label TruckID='Truck Identification Number'
         Defects='Number of Paint Defects';
   datalines;
R1  7   R2   3   R3   3   R4  14   R5  7
R6  9   R7   3   R8  11   S4   6   S9  8
S7  3   S6  10   T3   9   T4   4   T7  7
X1  7   X2  18   X3   3   X9  11   X4  5
;

options nogstyle;
goptions ftext='albany amt';
symbol v=dot color=red height=.8;
title 'c Chart for Paint Defects in New Trucks';
proc shewhart data=Trucks2 limits=Deflim;
   cchart Defects*TruckID / cframe   = steel
                            cconnect = red
                            cinfill  = ligr
                            coutfill = yellow ;
run;
options gstyle;

data Shirts;
   input Box avgdefu @@;
   avgdefn=10;
   datalines;
 1  0.4   2  0.7   3  0.5   4  1.0   5  0.3
 6  0.2   7  0.0   8  0.4   9  0.4  10  0.6
11  0.2  12  0.7  13  0.3  14  0.1  15  0.3
16  0.6  17  0.6  18  0.3  19  0.7  20  0.3
21  0.0  22  0.1  23  0.5  24  0.6  25  0.4
;

title 'Average Number of Shirt Flaws';
proc print data=Shirts(obs=5) noobs;
run;

ods graphics on;
title 'Total Flaws per Box of Shirts';
proc shewhart history=Shirts;
   cchart avgdef*Box / odstitle=title;
run;

data Shirts2;
   input Box Flaws Nshirts @@;
   datalines;
 1  3  10    2  8  10    3 15  25    4 20  25
 5  9  25    6  1  10    7  1  10    8 21  50
 9  3  10   10  7  10   11  1  10   12 21  25
13  9  25   14  3  25   15 12  50   16 18  50
17  7  10   18  4  10   19  8  10   20  4  10
;

title 'Number of Shirt Flaws per Box';
proc print data=Shirts2(obs=5) noobs;
run;

proc shewhart data=Shirts2;
   cchart Flaws*Box / subgroupn  = Nshirts
                      outhistory = shirthist
                      nochart;
run;

title 'Average Defects Per Shirt';
proc print data=Shirthist(obs=5) noobs;
run;