/**********************************************************************/


/* Step 1: Restructuring the Data Set */

data survey2;                              
    set survey;                            
    array cat_vars{*} room staff food cost;
    do category=1 to 4;                    
       response=cat_vars{category};        
       output;                             
    end;                                   
    drop room staff food cost;             
run;                                       


/**********************************************************************/


array cat_vars{*} room--cost;


/**********************************************************************/


/* Step 2: Generating the Table */

options pagesize=60 linesize=64 nodate nonumber nocenter;
                                                         
proc format;                                             
   value $monf 'AUG'='August' 'SEP'='September';         
   value respf 1='Great' 2='Good'  3='Fair' 4='Poor';    
   value catf  1='Room'  2='Staff' 3='Food' 4='Cost';    
run;                                                     
                                                         
proc tabulate data=survey2 format=9.;                    
   class month category response;                        
   table (month all)*category, response                  
         / rts=22 misstext='0';                          
   title 'Hotel Survey Results for the Fall';            
   format month $monf. response respf. category catf.;   
   label month='Month' response='Response'               
      category='Category';                               
   keylabel all='All' n=' ';                             
run;


/**********************************************************************/