Applying Tests for Linear Trends
/****************************************************************/
/* S A S S A M P L E L I B R A R Y */
/* */
/* NAME: SHWTSC5 */
/* TITLE: Applying Tests for Linear Trends */
/* 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 */
/* */
/****************************************************************/
proc iml;
nrof_samples = 200;
mu = 10;
sample = do(0,nrof_samples-1,1);
noise_vec = j(1,nrof_samples,0.0);
call randseed(123456787,1);
call randgen(noise_vec,"Normal");
x0 = mu*j(1,nrof_samples,1.0) + sqrt(0.3)*noise_vec;
x1 = x0+0.03#sqrt(0.3)#(j(1,100,0.0) || (1:(nrof_samples-100)));
y = sample` || x1`;
create work.temp from y[colname={"Sample" "Simulated Drifting Process"}];
append from y;
close work.temp;
quit;
ods graphics off;
title 'Shewhart chart for drifting process';
proc shewhart data=work.temp;
irchart Simulated_Drifting_Process*Sample /
tests=s(k=25 clev=0.02 form=N code=C
legend='Nonparametric Slope Test Signaled')
odstitle=title
nochart2
totpanels=1
outtable=work.temp_out;
run;