BookmarkSubscribeRSS Feed
Quentin
Super User

Hi,

I'm using PROC SHEWHART to make a chart with tests=3 to detect runs of 6 increasing / decreasing values.

In below example (modified from docs), I create a run of 8 increasing values.  But only the first 6 values are highlighted in red. And in the output dataset, only the 6th value is flagged by the _Tests_ variable.

Is there any way to make all values in a run (8 in this case) be highlighted, and make the _Tests_ variable indicate rule 3 was violated for all 8 records? (Other than of course counting myself)

Sample code and listing below, graph attached.

Thanx,

-Q.

data Assembly;
length System $ 1 comment $ 16;
label Sample = 'Sample Number';
input System Sample OffsetX OffsetR OffsetN comment $16. ;
if sample=19 then offsetX=21.5; *makes a run of 8;
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
;


ods graphics off;
title 'Analysis of Assembly Data';
proc shewhart history=Assembly2;
xrchart Offset * Sample / 
  outtable=ShewResults
  mu0 = 20
  sigma0 = 2.24
  limitn = 5
  alln
  tests = 3
  vaxis = 16 to 26 by 2
  split = '/';
  label OffsetX = 'Avg Offset in cm/Range'
;
run;

proc print data=shewresults;
  var sample _subx_ _tests_;
run;

***listing:
Sample    _SUBX_    _TESTS_

   1       19.80
   2       17.16
   3       20.11
   4       20.89
   5       20.83
   6       18.87
   7       20.84
   8       23.33
   9       19.21
  10       20.48
  11       22.05
  12       20.02
  13       17.58
  14       19.11
  15       20.03
  16       20.56
  17       20.86
  18       21.10       3
  19       21.50
  20       21.76
  21       21.76
  22       20.54
  23       20.04
  24       19.94
  25       20.70
  26       21.40
  27       21.32
  28       20.03
  29       22.02
  30       21.32



spc.png

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 0 replies
  • 1490 views
  • 0 likes
  • 1 in conversation