ANOM for Cell Means in the Presence of Interaction

/************************************************************************/
/*          S A S   S A M P L E   L I B R A R Y                         */
/*                                                                      */
/*    NAME: ANMXEX6                                                     */
/*   TITLE: ANOM for Cell Means in the Presence of Interaction          */
/* PRODUCT: QC                                                          */
/*  SYSTEM: ALL                                                         */
/*    KEYS: ANOM Charts, Means Charts, XCHART, Two Factor, Interaction  */
/*   PROCS: ANOM                                                        */
/*    DATA:                                                             */
/*                                                                      */
/* SUPPORT: saswgr                                                      */
/*     REF: PROC ANOM, XCHART Statement, Example 6                      */
/*                                                                      */
/************************************************************************/

data CleaningInteract;
   do position = 1 to 5;
      do depth = 1 to 3;
         do rep = 1 to 2;
            input concentration @@;
            output;
         end;
      end;
   end;
datalines;
15 16 15 14 19  5
15 16 14 14  0  1
19 15 16 16 11  8
18 16 24 23  8 14
15 12 23 24  8 11
;

ods graphics off;
proc glm data=CleaningInteract;
   class position depth;
   model concentration = position depth position*depth;
run;

proc means data=CleaningInteract n mean std;
   class position depth;
   var concentration;
   types position*depth;
   output out=cellmeans mean=concentrationX std=concentrationS;
run;
data cellmeans; set cellmeans;
   rename _FREQ_ = concentrationN;
   pos = put(position, z1.);
   dep = put(depth, z1.);
   cell  = cat('P',pos, 'D', dep);
   drop _TYPE_ pos dep;
run;

ods graphics off;
title "ANOM for Cell Means of Position and Depth";
proc ANOM summary = cellmeans;
   xchart concentration * cell / turnhlabels;
   label concentrationX = 'Mean of Concentration';
   label cell           = 'Cell';
run;