Resources

Mean (X-BAR) Chart Examples

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

data Partgaps;
   input Sample @;
   do i=1 to 5;
      input Partgap @;
      output;
   end;
   drop i;
   label Partgap='Gap Width'
         Sample ='Sample Index';
   datalines;
 1 255 270 268 290 267
 2 260 240 265 262 263
 3 238 236 260 250 256
 4 260 242 281 254 263
 5 268 260 279 289 269
 6 270 249 265 253 263
 7 280 260 256 256 243
 8 229 266 250 243 252
 9 250 270 245 273 262
10 248 258 247 266 256
11 280 251 252 270 287
12 245 253 243 279 245
13 268 260 289 275 273
14 264 286 275 271 279
15 271 257 263 247 247
16 291 250 273 265 266
17 228 253 240 260 264
18 270 260 269 245 276
19 259 257 246 271 257
20 252 244 230 266 248
21 254 251 239 233 263
;



title 'The Data Set PARTGAPS';
proc print data=Partgaps(obs=10) noobs;
run;

ods graphics off;
title 'Mean Chart for Gap Widths';
proc shewhart data=Partgaps;
   xchart Partgap*Sample;
run;

data Parts;
   input Sample PartgapX PartgapR;
   PartgapN=5;
   label PartgapX='Mean of Gap Width'
         Sample  ='Sample Index';
   datalines;
 1  270  35
 2  258  25
 3  248  24
 4  260  39
 5  273  29
 6  260  21
 7  259  37
 8  248  37
 9  260  28
10  255  19
11  268  36
12  253  36
13  273  29
14  275  22
15  257  24
16  269  41
17  249  36
18  264  31
19  258  25
20  248  36
21  248  30
;


title 'The Data Set PARTS';
proc print data=Parts(obs=5) noobs;
run;

options nogstyle;
goptions ftext='albany amt';
title 'Mean Chart for Gap Width';
proc shewhart history=Parts;
   xchart Partgap*Sample / cframe   = vigb
                           cinfill  = vlib
                           cconnect = red;
run;
options gstyle;

proc shewhart data=Partgaps;
   xchart Partgap*Sample / outhistory = Gaphist
                           nochart;
run;

title 'Summary Data Set for Gap Widths';
proc print data=Gaphist(obs=5) noobs;
run;

proc shewhart data=Partgaps;
   xchart Partgap*Sample / outhistory = Gaphist2
                           stddeviations
                           nochart;
run;

title 'Summary Data Set with Subgroup Standard Deviations';
proc print data=Gaphist2(obs=5) noobs;
run;

proc shewhart data=Partgaps;
   xchart Partgap*Sample / outlimits = Gaplim
                           nochart;
run;

title 'Control Limits for Gap Width Measurements';
proc print data=Gaplim noobs;
run;

proc shewhart data=Partgaps;
   xchart Partgap*Sample / outtable=Gaptable
                           nochart;
run;

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

title 'Mean Chart for Gap Widths';
proc shewhart table=Gaptable;
   xchart Partgap*Sample;
label _SUBX_ = 'Gap Width';
run;

data Gaps2;
   input Sample @;
   do i=1 to 5;
      input Partgap @;
      output;
   end;
   drop i;
   datalines;
22 287 265 248 263 271
23 267 253 285 251 271
24 249 252 277 269 241
25 243 248 263 282 261
26 287 266 256 278 242
27 251 262 243 274 245
28 256 245 244 243 272
29 262 247 252 277 266
30 244 269 263 278 261
31 245 264 246 242 273
32 272 257 277 265 241
33 251 249 240 260 261
34 289 277 275 273 261
35 267 286 275 261 272
36 266 256 247 255 241
37 291 267 267 252 262
38 258 245 264 245 281
39 277 267 241 272 244
40 252 267 272 245 252
41 243 241 245 263 248
;

ods graphics on;
title 'Mean Chart for Gap Widths';
proc shewhart data=Gaps2 limits=Gaplim;
   xchart Partgap*Sample / odstitle=title;
run;