Macro for Multiple of Std Error for ANOM
/****************************************************************/
/* S A S S A M P L E L I B R A R Y */
/* */
/* NAME: ANOMSIG */
/* TITLE: Macro for Multiple of Std Error for ANOM */
/* PRODUCT: QC */
/* SYSTEM: ALL */
/* KEYS: ANOM, Analysis of of Means, */
/* PROCS: */
/* DATA: */
/* */
/* REF: P. R. Nelson (1982), "Exact Critical Points for the */
/* Analysis of Means", Communications in Statistics, */
/* A11, 699-709 */
/* */
/* Robert N. Rodriguez (1996), "Health Care */
/* Applications of Statistical Process Control: */
/* Examples Using the SAS System", Proceedings of the */
/* Twenty-First Annual SAS Users Group International */
/* Conference, 1381-1396 */
/* */
/* NOTES: This macro provides the multiple of standard error */
/* for analysis of means (ANOM) for infinite degrees */
/* of freedom. The multiple &sigmult is the value */
/* required for the SIGMAS= option in the SHEWHART */
/* procedure for an ANOM involving k groups and */
/* infinite degrees of freedom. */
/* */
/* The significance level alpha can set as 0.10, 0.05, */
/* or 0.01. */
/* */
/* k must be in range 3 <= k <= 60 */
/* */
/* This macro is used in the ANOMP and ANOMU sample */
/* programs. */
/* */
/****************************************************************/
%macro anomsig(alpha,k);
%global sigmult;
data _null_;
/* check arguments */
if &k lt 3 then do;
put 'ERROR: k must be greater than 2.';
abort;
end;
if &k gt 60 then do;
put 'ERROR: Macro not valid for k > 60.';
abort;
end;
/* build arrays to contain the halpha */
/* approximations */
array h{19} h1-h19;
h1 = .;
h2 = .;
if &alpha = 0.10 then do;
array b10{4} b1-b4;
b10{1} = 2.326409;
b10{2} = 0.031757;
b10{3} = -0.000493;
b10{4} = 0.000003114;
h3 = 2.052;
h4 = 2.193;
h5 = 2.289;
h6 = 2.363;
h7 = 2.423;
h8 = 2.473;
h9 = 2.516;
h10 = 2.554;
h11 = 2.587;
h12 = 2.618;
h13 = 2.645;
h14 = 2.671;
h15 = 2.694;
h16 = 2.716;
h17 = 2.735;
h18 = 2.755;
h19 = 2.773;
end;
else
if &alpha = 0.05 then do;
array b05{4} b1-b4;
b05{1} = 2.597909;
b05{2} = 0.028231;
b05{3} = -0.000419;
b05{4} = 0.000002551;
h3 = 2.344;
h4 = 2.468;
h5 = 2.555;
h6 = 2.621;
h7 = 2.676;
h8 = 2.721;
h9 = 2.761;
h10 = 2.796;
h11 = 2.827;
h12 = 2.855;
h13 = 2.881;
h14 = 2.904;
h15 = 2.926;
h16 = 2.946;
h17 = 2.965;
h18 = 2.983;
h19 = 2.999;
end;
else
if &alpha = 0.01 then do;
array b01{4} b1-b4;
b01{1} = 3.099409;
b01{2} = 0.025932;
b01{3} = -0.000397;
b01{4} = 0.000002489;
h3 = 2.914;
h4 = 3.013;
h5 = 3.084;
h6 = 3.140;
h7 = 3.185;
h8 = 3.224;
h9 = 3.258;
h10 = 3.288;
h11 = 3.315;
h12 = 3.340;
h13 = 3.362;
h14 = 3.382;
h15 = 3.401;
h16 = 3.419;
h17 = 3.435;
h18 = 3.451;
h19 = 3.466;
end;
else do;
put 'ERROR: Alpha not 0.10, 0.05, or 0.01';
abort;
end;
if &k < 20 then sigmult = h{&k};
else sigmult = b1 +
b2*&k +
b3*&k*&k +
b4*&k*&k*&k;
sigmult = sigmult * sqrt((&k - 1)/&k);
call symput('sigmult',left(put(sigmult,8.3)));
%mend anomsig;