options pagesize=150 linesize=68;
filename grafout 'g01.ps';
goptions device=pslmono gsfname=grafout 
   rotate=landscape gsfmode=append;
/*************************************************************/
/* Mark.H Confidence interval for real data                  */
/*************************************************************/
title 'Binomial Confidence Interval for cancer death';
/*************************************************************/
/*  Prostate data                                            */
/* From Andrews and Herzberg (1985), Data: A Collection of   */
/* Problems from Many Fields for the Student and Research    */
/* Worker, Table 46.  Observations represent subjects in a   */
/* prostate cohort study, randomized to one of four dose     */
/* levels of diethylstilbestrol.  Rx records dose in four    */
/* ordered categories, with 1 being placebo.  Disease stage  */
/* is 3 or 4.  monfol is months of followup.  surv is 0 if   */
/* alive after 50 mo, and codes cause of death otherwise.    */
/* http://lib.stat.cmu.edu/datasets/Andrews/T46.1            */
/* The on-line version of the data set adds 3 fields before  */
/* the first field in the book.  Variables of interest are   */
/* stage, rx, monfol, and surv in fields 5, 6, 10, 11 of the */
/* online version, resp.  Causes of death are given by var-  */
/* ious positive integers in surv; I recode these to 1.  The */
/* data file has more columns than we are interested in.  Put*/
/* place-holding variables in for variables not of interest  */
/* between variables of interest.  Data were previously pub- */
/* lished by Byar and Corle (1977 Chronic Disease) and Byar  */
/* and Green (1980 Bull. Cancer).  Lower value of dichoto-   */
/* mized dose begins with blank to make it alphabetized      */
/* before high.                                              */
/*************************************************************/
* If we omit the ones past where the data of interest stops   ;
*  out of the data step, SAS will ignore them.                ;
data prostate; infile 'T46.1';
   input tableno subtableno lineno patno stage rx beginmo 
      beginday beginyear monfol surv;
   if surv>0 then alive=0; if surv=0 then alive=1; 
   dose=" low"; if rx>1 then dose="high"; 
   keep stage rx monfol alive dose; run;
data stage4; set prostate; if stage<4 then delete; run;
proc freq data=prostate; tables alive/binomial; run;