/*-----------------------------------------------------------------
            S A S   S A M P L E   L I B R A R Y                   
                                                                  
      NAME: CATEX3                                                
     TITLE: Example 3 for PROC CATMOD                             
   PRODUCT: STAT                                                  
    SYSTEM: ALL                                                   
      KEYS: categorical data analysis                             
     PROCS: CATMOD                                                
      DATA:                                                       
                                                                  
   SUPPORT: Bob Derr                                              
       REF: SAS/STAT User's Guide, PROC CATMOD chapter            
      MISC:                                                       
                                                                  
-----------------------------------------------------------------*/

/*----------------------------------------------------------------
 Example 3: Logistic Regression, Standard Response Function

          Maximum Likelihood Logistic Regression
          --------------------------------------
 Ingots prepared with different heating and soaking times are
 tested for readiness to roll.

 From: Cox (1970, 67-68).
----------------------------------------------------------------*/

data ingots;
   input Heat Soak nready ntotal @@;
   Count=nready;
   Y=1;
   output;
   Count=ntotal-nready;
   Y=0;
   output;
   drop nready ntotal;
   datalines;
7 1.0 0 10   14 1.0 0 31   27 1.0 1 56   51 1.0 3 13
7 1.7 0 17   14 1.7 0 43   27 1.7 4 44   51 1.7 0  1
7 2.2 0  7   14 2.2 2 33   27 2.2 0 21   51 2.2 0  1
7 2.8 0 12   14 2.8 0 31   27 2.8 1 22   51 4.0 0  1
7 4.0 0  9   14 4.0 0 19   27 4.0 1 16
;

title 'Maximum Likelihood Logistic Regression';
proc catmod data=ingots;
   weight Count;
   direct Heat Soak;
   model Y=Heat Soak / freq covb corrb itprint design;
quit;