/*------------------------------------------------------------*/
/*                                                            */
/*SAS Example IX      Stat345       Categorical Data Analysis */
/*                                                            */
/*Pressure Load /Aircraft Fastener Study                      */
/*                                                            */
/*------------------------------------------------------------*/

Options LS=78;

Data Aircraft;
  INPUT PSI F_Lab $ Freq;
  Cards;
  2500 Fail     10
  2500 Not_Fail 40
  2700 Fail     17
  2700 Not_Fail 53
  2900 Fail     30
  2900 Not_Fail 70
  3100 Fail     21
  3100 Not_Fail 39
  3300 Fail     18
  3300 Not_Fail 22
  3500 Fail     43
  3500 Not_Fail 42
  3700 Fail     54
  3700 Not_Fail 36
  3900 Fail     33
  3900 Not_Fail 17
  4100 Fail     60
  4100 Not_Fail 20
  4300 Fail     51
  4300 Not_Fail 14
  ;

/*Fit a linear logit model to the data using Proc CATMOD.     */
/*  The 'Order=Data' specification maintains the ordering of  */
/*     the variable levels in which the data was input.       */
/*  The 'Weight' statement identifies the cell frequency      */
/*     variable.                                              */
/*  The 'Direct' statement identifies explanatory variables   */
/*     which should be treated as quantitative as opposed to  */
/*     qualitative.                                           */
/*  The 'Title' statement assigns a heading to each page of   */
/*     output.                                                */

Proc CATMOD Order = Data;
  Weight Freq;
  Direct PSI;

/*  Model log (p(yi=1)/p(yi=0))= a + b * xi;                  */
/*        yi=1 if ith fastener fails, 0 otherwise;            */
/*        xi=PSI applied to ith fastener                      */

  Model F_Lab = PSI;
  Title 'Pressure Load /Aircraft Fastener Study';
  Run;

Submit to see output