Resources

Analysis of Means with Equal Sample Sizes

 /****************************************************************/
 /*          S A S   S A M P L E   L I B R A R Y                 */
 /*                                                              */
 /*    NAME: ANOMX1                                              */
 /*   TITLE: Analysis of Means with Equal Sample Sizes           */
 /* PRODUCT: QC                                                  */
 /*  SYSTEM: ALL                                                 */
 /*    KEYS: ANOM, Analysis of Means,                            */
 /*   PROCS: SHEWHART                                            */
 /*    DATA:                                                     */
 /*     REF: L.S. Nelson (1983), 'Exact Critical Values for      */
 /*          Use with the Analysis of Means'. Journal of Quality */
 /*          Technology 15, pp. 40-44.                           */
 /*                                                              */
 /*          D.O. Fulenwider (1988), 'Using SAS Software for     */
 /*          Analysis of Means', "SAS Users Group International: */
 /*          Proceedings of the Thirteenth Annual Conference,    */
 /*          1212-1219.                                          */
 /*                                                              */
 /*   NOTES: This sample program uses the anomh1 macro defined   */
 /*          in sample program ANOMH1.  Those statements must be */
 /*          submitted before this sample program.               */
 /*                                                              */
 /****************************************************************/

 data example1;
   input aggregt $ 2  @;
   do i = 1 TO 6;
      input moisture @;
      output;
      end;
   drop i;
   cards;
 1    551 457 450 731 499 632
 2    595 580 508 583 633 517
 3    639 615 511 573 648 677
 4    417 449 517 438 415 555
 5    563 631 522 613 656 679
 ;

 proc shewhart data=example1;
    xchart moisture*aggregt /
           nochart
           stddevs
           smethod=rmsdf
           outhistory=hist1
           outlimits=lim1;

 data hist1a;
    set hist1 end=eof;
    retain n;
    if _n_ = 1 then do;
       n=moisturen;
       call symput('n',left(put(moisturen,4.)));
       end;
    if eof then do;
       set lim1(keep=_stddev_);
       mse=(_stddev_ * c4(n*_n_ - (_n_-1)))**2;
       msedf=_n_*(n-1);
       call symput('ntrt',left(put(_n_,4.)));
       call symput('mse',left(put(mse,8.3)));
       call symput('msedf',left(put(msedf,8.)));
       end;
 run;

 /*  NOTE:  Alpha level is .05, halpha is calculated    */

 %anomh1(.05,&msedf,&ntrt);

 data lim1a;
    set lim1;

    halpha=&halpha;
    hdelta=&halpha*sqrt(&mse)*sqrt((&ntrt-1)/(&ntrt*&n));
    _lclx_=_mean_-hdelta;
    _uclx_=_mean_+hdelta;
    _stddev_=sqrt(&mse);
    _alpha_=.05;
 run;

 symbol1 v=none h=3 c=black w=20 f=;

 title1 font=swiss h=1.5 c=black 'Analysis of Means';
 title2 font=swiss h=.9 c=black 'Equal Sample Sizes';
 proc shewhart history=hist1a limits=lim1a;
    xchart moisture*aggregt/
          stddevs
          smethod=rmsdf
          ct=black
          cframe=tan
          climits=black
          ca=black
          cout=orange
          font=swiss
          readalpha
          noconnect
          cneedles=green
          nolegend
          ucllabel='UDL'
          lcllabel='LDL'
          haxis=(' ' '1' '2' '3' '4' '5' ' ');
    label moisturex= 'Moisture Absorption'
          aggregt= 'Concrete Aggregate';
 run;