Resources

Customizing Tests with DATA Step Programs

/****************************************************************/
/*          S A S   S A M P L E   L I B R A R Y                 */
/*                                                              */
/*    NAME: SHWTSC5                                             */
/*   TITLE: Customizing Tests with DATA Step Programs           */
/* PRODUCT: QC                                                  */
/*  SYSTEM: ALL                                                 */
/*    KEYS: Shewhart Charts, Test for Special Causes,           */
/*   PROCS: SHEWHART                                            */
/*    DATA:                                                     */
/*                                                              */
/*     REF: SAS/QC Software:  Usage and Reference, Version 6,   */
/*          First Edition, Volume 1 and Volume 2                */
/*                                                              */
/****************************************************************/

data Assembly;
   length System $ 1 comment $ 16;
   label Sample = 'Sample Number';
   input System Sample OffsetX OffsetR OffsetN comment $16. ;
   datalines;
T   1  19.80  3.8  5
T   2  17.16  8.3  5
T   3  20.11  6.7  5
T   4  20.89  5.5  5
T   5  20.83  2.3  5
T   6  18.87  2.6  5
T   7  20.84  2.3  5
T   8  23.33  5.7  5  New Tool
T   9  19.21  3.5  5
T  10  20.48  3.2  5
T  11  22.05  4.7  5
T  12  20.02  6.7  5
T  13  17.58  2.0  5
T  14  19.11  5.7  5
T  15  20.03  4.1  5
R  16  20.56  3.7  5  Changed System
R  17  20.86  3.3  5
R  18  21.10  5.6  5  Reset Tool
R  19  19.05  2.7  5
R  20  21.76  2.8  5
R  21  21.76  6.4  5
R  22  20.54  4.8  5
R  23  20.04  8.2  5
R  24  19.94  8.8  5
R  25  20.70  5.1  5
Q  26  21.40 12.1  7  Bad Reading
Q  27  21.32  3.2  7
Q  28  20.03  5.2  7  New Gauge
Q  29  22.02  5.9  7
Q  30  21.32  4.3  7
;


proc shewhart history=Assembly;
   xchart Offset * Sample /
      sigmas   = 2.5
      outtable = First
      nochart ;
run;

title ;
proc print data=First(obs=10) noobs;
run;

data First;
   set First;
   length _tests_ $ 8;
   if _subx_ > _uclx_ then substr( _tests_, 1 ) = '1';
run;

ods graphics off;
title 'Customized Analysis of Assembly Data';
proc shewhart table=First;
   xchart Offset * Sample / tests      = 1
                            testlabel1 = 'Test Signaled';
   label _subx_ = 'Average Offset in cm';
run;