/*-----------------------------------------------------------------
            S A S   S A M P L E   L I B R A R Y                   
                                                                  
      NAME: ODSEX8                                                
     TITLE: Documentation Example 8 for ODS                       
   PRODUCT: STAT                                                  
    SYSTEM: ALL                                                   
      KEYS: ODS                                                   
     PROCS: ANOVA, TEMPLATE                                       
      DATA:                                                       
                                                                  
   SUPPORT: saswfk                UPDATE: July 25, 2011           
       REF: Using the Output Delivery System                      
      MISC:                                                       
-----------------------------------------------------------------*/

title 'Product Defects Experiment';

data Experiment;
   do Supplier = 'A', 'B', 'C', 'D';
      do Machine = 1 to 4;
         do rep = 1 to 5;
            input Defects @@;
            output;
         end;
      end;
   end;
   datalines;
 2  6  3  3  6  8  6  6  4  4  4  2  4  0  4  5  5  7  8  5
13 12 12 11 12 16 15 14 14 13 11 10 12 12 10 13 13 14 15 12
 2  6  3  6  6  6  4  4  6  6  0  3  2  0  2  4  6  7  6  4
20 19 18 21 22 22 24 23 20 20 17 19 18 16 17 23 20 20 22 21
;

/*
ods graphics off;
ods _all_ close;
ods html body='anovab.htm' style=HTMLBlue anchor='anova1';
ods trace output;
*/

proc anova data=Experiment;
   ods select ModelANOVA MCLines;
   class Supplier Machine;
   model Defects = Supplier Machine;
   means Supplier Machine / tukey;
quit;

/*
ods html close;
ods html;
ods pdf;
*/

proc template;
   edit Stat.GLM.Tests;
      edit Source;
         cellstyle _val_ = 'Supplier' as {url="#ANOVA2"},
                   _val_ = 'Machine'  as {url="#ANOVA3"};
      end;
   end;
run;

/*
ods _all_ close;
ods html body='anovab.htm' style=HTMLBlue anchor='anova1';
*/

proc anova data=Experiment;
   ods select ModelANOVA MCLines;
   class Supplier Machine;
   model Defects = Supplier Machine;
   means Supplier Machine / tukey;
quit;

/*
ods html close;
ods html;
ods pdf;
*/

proc template;
   list Stat.GLM.Tests;
run;

proc template;
   delete Stat.GLM.Tests / store=sasuser.templat;
run;