/*-----------------------------------------------------------------*/
/*                                                                 */
/*SAS Example I           Stat345         Categorical Data Analysis*/
/*                                                                 */
/*Aspirin /Heart Attack Study                                      */
/*-----------------------------------------------------------------*/

Options LS=78;

Data HA;
  INPUT Trt_Grp $ MI $ Freq @@;
  Cards;
  Placebo HA 189  Placebo No_HA 10845
  Asperin HA 104  Aspirin No_HA 10933
  ;

/*Analyze the data using Proc FREQ.                                */
/*  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 'RelRisk' option produces estimates for the odds ratio     */
/*          and the relative risk.                                 */
/*  The 'Title' statement assigns a heading to each page of output.*/

Proc FREQ Order = Data;
  Weight Freq;
  Tables Trt_Grp*MI / RelRisk;
  Title 'Aspirin / Heart Attack Study';
  Run;

Submit to see output