Chapter Contents


The MEANS Procedure

Example 5: Using Multi-label Value Formats with Class Variables

Procedure features:
PROC MEANS statement options:
statistic keywords
CLASS statement options:
TYPES statement
Other features
FORMAT procedure
FORMAT statement
Data set: CAKE

This example


options nodate pageno=1 linesize=80 pagesize=64;
 Note about code
proc format;
   value $flvrfmt
                'Rum','Spice'='Other Flavor';
   value agefmt (multilabel)
                  15 - 29='below 30 years'
                  30 - 50='between 30 and 50'
                  51 - high='over 50 years'
                  15 - 19='15 to 19'
                  20 - 25='20 to 25'
                  25 - 39='25 to 39'
                  40 - 55='40 to 55'
                  56 - high='56 and above'; 
 Note about code
proc means data=cake fw=6 n min max median nonobs;
 Note about code
   class flavor/order=freq;
   class  age /mlf order=fmt;
 Note about code
    types flavor flavor*age;
 Note about code
   var TasteScore;
 Note about code
   format age agefmt. flavor $flvrfmt.;
   title 'Taste Score for Cake Flavors and Participant''s Age';

The one-way combination of class variables appears before the two-way combination. A field width of six truncates the statistics to four decimal places. For the two-way combination of Age and Flavor, the total number of observations is greater than the one-way combination of Flavor. This is because of the multi-label format for age, which maps one internal value to more than one formatted value.

The order of the levels of Flavor is based on the frequency count for each level. The order of the levels of Age is based on the order of the user-defined formats.

[HTML Output]
 [Listing Output]

Chapter Contents



Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.