A Cake Icing Design in Blocks

 /****************************************************************/
 /*              S A S   S A M P L E   L I B R A R Y             */
 /*                                                              */
 /*    NAME: ADXEG3                                              */
 /*   TITLE: A Cake Icing Design in Blocks                       */
 /* PRODUCT: QC                                                  */
 /*  SYSTEM: ALL                                                 */
 /*    KEYS: Design of Experiments,Fractional Factorial Designs  */
 /*   PROCS:                                                     */
 /*    DATA:                                                     */
 /*     REF: Cochran, W.G. and Cox, G.M. (1957). Experimental    */
 /*               Designs. Second Edition, New York: John Wiley  */
 /*               & Sons, pp. 253-254, 268-270.                  */
 /*    MISC: ADX Macros are stored in the AUTOCALL library       */
 /*                                                              */
 /* Cochran and Cox (1957) report using a half-fraction factorial*/
 /* design with four blocks to analyze the texture of icing for  */
 /* cakes. Factors A, B, C, D, and E are different constituents  */
 /* that go into the commercial manufacture of the icing, and    */
 /* factor F is a variable that the housewife may introduce in   */
 /* using the icing.                                             */
 /*                                                              */
 /****************************************************************/




 /*--------------------------------------------------------------*/
 /*         EXAMPLE 3:  A DESIGN FOR A CAKE ICING STUDY.         */
 /*               SOURCE:  COCHRAN AND COX (1957).               */
 /*--------------------------------------------------------------*/

 /*
 /  For this example, we need only the fractional factorial macros:
 /  if we haven't already included them, we do so now.
 /---------------------------------------------------------------*/
 %adxgen;
 %adxff;
 %adxinit                        /* Initialize ADX environment.  */

 /*
 /  Find out which designs are available for 6 treatment factors.
 /---------------------------------------------------------------*/
 %adxpff((ntmts=6))

 /*
 /  Cochran and Cox choose a 32-run design of resolution 6 and
 /  convert it to one of resolution 4 by adding the block variable.
 /  The only decoding required here is to change the names of the
 /  variables.
 /---------------------------------------------------------------*/
 %adxffd(icing,6,32)
 %adxdcode(icing,t1 a /t2 b /t3 c /t4 d /t5 e /t6 f)
 data icing;
   set icing;
   drop b1 b2;
   b1 = (( -c*d) + 1)/2;      /* Two 0-1 blocking pseudo-factors */
   b2 = ((a*b*c) + 1)/2;      /*    CC, p. 268                   */

   block = (b1 + 2*b2) + 1;   /* A diff. block for each comb.    */
 run;

 /*
 /  Normally, we would want to write a report which will print the
 /  runs in the design in a randomized order and provide space for
 /  a researcher to fill in the values of a response: use the
 /  following to do this:
 /                   %adxrprt(icing,texture)
 /  Assuming this has been done, we add the data to the design with
 /  the following DATA step: the numbers can be found in Cochran
 /  and Cox (1957), pages 254 and 268. Also, artificial block
 /  effects of -40, +10, 0, and +30 per observation are
 /  superimposed on the data.
 /---------------------------------------------------------------*/
 data icing;
    set icing;
    input @@ texture;
    if      block = 1 then texture = texture - 40;
    else if block = 2 then texture = texture + 10;
    else if block = 3 then texture = texture +  0;
    else                   texture = texture + 30;
    cards;
 233 200 250 267 250 400 400 117 267 283 400 150 333 317 283 267
 217 350 267 200 233 333 250 367 317 150 267 350 350 383 317 217
 ;

 /*
 /  Recode and analyze this data set.
 /--------------------------------------------------------------*/
 %adxcode(icing,icing,a b c d e f,block)
 %adxffa(resp=texture,res=4)