The TABLES statement requests a three-way table stratified by Subject and a two-way table. Emotion and SkinResponse form the rows and columns of each table. CMH2 requests the first two Cochran-Mantel-Haenszel statistics. SCORES=RANK uses rank scores to compute these statistics. NOPRINT suppresses the display of contingency tables.
proc freq data=hypnosis;
   tables subject*emotion*skinresponse emotion*skinresponse
          /cmh2 scores=rank noprint;