*-- Demonstration for FOURFOLD.SAS;
goptions vsize=7.5 hsize=7.5;     /* make plot square */
*-- fourfold display  for 2 x 2 x k tables;
proc iml;
%include fourfold;

   *-- Berkeley Admissions data;
   dim = {2 2 6};
   vnames = {"Admit?" "Sex" "Department"};
   lnames = {"Yes" "No" " "  " "  " "  " ",
         /*  "Male"  "Female" " "  " "  " "  " ", */
             " M "   " F "    " "  " "  " "  " ",
             "A" "B" "C" "D" "E" "F"};

   /* Admit: Yes   No   Yes  No    */
   /* Gender:   M          F       */
   table = { 512  313,   89   19,
             353  207,   17    8,
             120  205,  202  391,
             138  279,  131  244,
              53  138,   94  299,
              22  351,   24  317};
   down=3;
   across=2;
   std='MAX';
   sangle=90;
   run fourfold(dim, table, vnames, lnames);
   std='MARG';
   run fourfold(dim, table, vnames, lnames);
quit;