c Chart Based on Known (Standard) Value

/****************************************************************/
/*          S A S   S A M P L E   L I B R A R Y                 */
/*                                                              */
/*    NAME: SHWCEX2                                             */
/*   TITLE: c Chart Based on Known (Standard) Value             */
/* 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
;


ods graphics on;
title 'c Chart for Paint Defects on New Trucks';
title2 'Usng Data in TRUCKS and Standard Value UO=7';
proc shewhart data=Trucks;
   cchart Defects*TruckID / u0        = 7
                            csymbol   = c0
                            odstitle  = title
                            odstitle2 = title2
                            markers
                            nolegend
                            nolimitslegend
                            nolimit0;
run;

data tlimits;
   length _subgrp_ _var_ _type_ $8;
   _U_      = 7;
   _subgrp_ = 'truckid';
   _var_    = 'defects';
   _limitn_ = 1;
   _type_   = 'STANDARD';

proc shewhart data=trucks limits=tlimits;
   cchart defects*truckid / csymbol=c0
                            nolegend
                            nolimitslegend
                            nolimit0;
run;