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

Data Set
--------

COURSE   LOCATION                       
                                        
BASICS   CARY                           
GRAPH    CARY                           
GRAPH    CHICAGO                        


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

                                        
proc tabulate;                          
   class course location;               
   table course*location, n;            
   table course*location, n / printmiss;
run;                                    


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

Partial Listing of SURVEY Data Set
----------------------------------

MONTH    CATEGORY    RESPONSE
                             
 SEP         1           3   
 SEP         2           2   
 SEP         3           1   
 SEP         4           2   
 AUG         1           1   
 AUG         2           2   
 AUG         3           3
 AUG         4           1


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


DUMMY Data Observation
----------------------

MONTH    CATEGORY    RESPONSE
                             
 SEP         1           4   


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

                             
data dummy;                  
   month='SEP';              
   category=1;               
   response=4;               
run;                         


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


data dummy;       
   category=1;    
   input response;
   cards;         
1                 
2                 
3                 
4                 
;                 


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

DUMMY Data Set
--------------

CATEGORY    RESPONSE
                    
   1           1    
   1           2    
   1           3    
   1           4    


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


data survey2;                    
   set survey(in=is_valid) dummy;
   if is_valid then valid=1;     
run;                             


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

Partial Listing of SURVEY2 Data Set
-----------------------------------

MONTH    CATEGORY    RESPONSE    VALID
                                      
 SEP         1           3         1  
 SEP         2           2         1  
 SEP         3           1         1  
 SEP         4           2         1  
 AUG         1           1         1  
 AUG         2           2         1  
 AUG         3           3         1  
 AUG         4           1         1  
 SEP         1           4         .  


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


proc tabulate data=survey2 format=8.;                        
   class month category response;                            
   var valid;                                                
   table (month all='All')*category, response*valid=' '*n=' '
         / rts=22 misstext='0';                              
   title 'Hotel Survey Results for the Fall';                
   format month $monf. response respf. category catf.;       
   label month='Month' response='Rating' category='Category';
run;                                                         


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


proc sort data=survey out=survey;
   by month;                     
run;                             
                                 
data survey2;                    
   set survey;                   
   by month;                     
   valid=1;                      
   output;                       
   if last.month then do;        
      valid=.;                   
      do i=1 to maxob;           
         set dummy point=i nobs=maxob;
         output;                      
      end;                            
   end;                               
run;                                  


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


SURVEY2 Data Set
----------------

MONTH    CATEGORY    RESPONSE    VALID
                                      
 AUG         1           1         1  
 AUG         2           2         1  
 AUG         3           3         1  
 AUG         4           1         1  
 AUG         1           1         .  
 AUG         1           2         .  
 AUG         1           3         .  
 AUG         1           4         .  
 SEP         1           3         1  
 SEP         2           2         1  
 SEP         3           1         1  
 SEP         4           2         1  
 SEP         1           1         .  
 SEP         1           2         .  
 SEP         1           3         .  
 SEP         1           4         .


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


proc tabulate data=survey2 format=8.;                 
   by month;                                          
   class category response;                           
   var valid;                                         
   table category, response*valid=' '*n=' '           
         / rts=22 misstext='0';                       
   title 'Hotel Survey Results For The Fall';         
   format month $monf. response respf. category catf.;
   label month='Month' response='Rating'              
      category='Category';                            
run;

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


options pagesize=60 linesize=64 nodate nonumber center
                                                     
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;                                                 


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