options pagesize=150 linesize=68;
filename grafout 'g12.ps';
goptions device=pscolor gsfname=grafout 
   rotate=landscape gsfmode=append;
/**************************************************************/
/* Mark A: Exact logistic regression.                         */
/**************************************************************/
/********************************************************/
/*Goorin, A.M., Perez--Atayde, A., Gebhardt, M., and    */
/*Andersen, J. (1987) Weekly High--Dose Methotrexate and*/
/*Doxorubicin for Osteosarcoma: The Dana--Farber Cancer */
/*Institute/The Children's Hospital -- Study III, J.    */
/*Clin. Oncol. 5, 1178--1184, quoted by Hirji, Mehta,   */
/*and Patel (1987).  Survival of osteogenic sarcoma pa- */
/*tients,  with covariates li (lymphatic infiltration), */
/*sex, and aop (any osteoid pathology), number of sub-  */
/*jects, and number of 5 year survivors.                */
/********************************************************/
data goorin; infile 'goorin.dat'; input li sex aop n y;
   run;
/**************************************************************/
/* Examine the data.  All individuals without li survive.     */
/**************************************************************/
proc print data=goorin; run;
/*************************************************************/
/* Fit using exact logistic regression.  The estimate of the */
/* li effect is -Infinity, since the best fit sets success   */
/* abilities to 1 when li=0.                                 */
/*************************************************************/
title 'Regular Logistic Regression for Sarcoma Data';
proc logistic data=goorin; model y/n = li sex aop; run;
title 'Exact Logistic Regression';
proc logistic data=goorin; model y/n = li sex aop;
     exact li sex aop / estimate = both outdist=dist; run;
proc print data=dist; run;
/**************************************************************/
/* Housing data from Cox and Snell (1980), Example W, on sat- */
/* isfaction with housing in Copenhagen.  Data was extracted  */
/* from R package MASS.                                       */
/**************************************************************/
data housing; infile 'housing.dat'; 
   input nn sat $ infl $ type $ contact $ freq ;
   nsat=1;if sat="Medium" then nsat=2; 
   if sat="High" then nsat=3;
   ninf=1;if infl="Medium" then ninf=2; 
   if infl="High" then ninf=3;
   ncont=1; if contact="High" then ncont=2;
   ntype=1;if type="Apartmen" then ntype=2;
   if type="Atrium" then ntype=3;if type="Terrace" then ntype=4;
   run;