Previous Page | Next Page

The MEANS Procedure

Example 12: Identifying the Top Three Extreme Values with the Output Statistics


Procedure features:

PROC MEANS statement option:

NOPRINT

CLASS statement

OUTPUT statement options:

statistic keywords

AUTOLABEL

AUTONAME

IDGROUP

TYPES statement

Other features:

FORMAT procedure

FORMAT statement

PRINT procedure

RENAME = data set option

Data set: CHARITY

This example


Program

 Note about code
options nodate pageno=1 linesize=80 pagesize=60;
 Note about code
proc format;
   value yrFmt . = " All";
   value $schFmt ' ' = "All    ";
run;
 Note about code
proc means data=Charity noprint;
 Note about code
   class School Year;
 Note about code
   types () school year;
 Note about code
   var MoneyRaised;
 Note about code
   output out=top3list(rename=(_freq_=NumberStudents))sum= mean= 
          idgroup( max(moneyraised) out[3] (moneyraised name 
            school year)=)/autolabel autoname;
 Note about code
   label MoneyRaised='Amount Raised';
   format year yrfmt. school $schfmt.
          moneyraised dollar8.2;
  run;
 Note about code
proc print data=top3list;
   title1 'School Fund Raising Report';
   title2 'Top Three Students';
run;
 Note about code
proc datasets library=work nolist;
   contents data=top3list;
   title1 'Contents of the PROC MEANS Output Data Set';
run;

Output

 Note about figure
                      School Fund Raising Report                         1
                               Top Three Students

                                     Money    Money
                          Number   Raised_  Raised_  Money    Money    Money
 Obs School  Year _TYPE_ Students      Sum     Mean Raised_1 Raised_2 Raised_3

  1  All      All    0      109   $3192.75   $29.29   $78.65   $72.22   $65.44
  2  All     1992    1       31    $892.92   $28.80   $55.16   $53.76   $52.63
  3  All     1993    1       32    $907.92   $28.37   $65.44   $47.33   $42.23
  4  All     1994    1       46   $1391.91   $30.26   $78.65   $72.22   $56.87
  5  Kennedy  All    2       53   $1575.95   $29.73   $72.22   $52.63   $43.89
  6  Monroe   All    2       56   $1616.80   $28.87   $78.65   $65.44   $56.87

 
 
 Obs Name_1  Name_2  Name_3  School_1 School_2 School_3 Year_1 Year_2 Year_3

  1  Willard Luther  Cameron Monroe   Kennedy  Monroe    1994   1994   1993 
  2  Tonya   Edward  Thelma  Monroe   Monroe   Kennedy   1992   1992   1992 
  3  Cameron Myrtle  Bill    Monroe   Monroe   Kennedy   1993   1993   1993 
  4  Willard Luther  L.T.    Monroe   Kennedy  Monroe    1994   1994   1994 
  5  Luther  Thelma  Jenny   Kennedy  Kennedy  Kennedy   1994   1992   1992 
  6  Willard Cameron L.T.    Monroe   Monroe   Monroe    1994   1993   1994 
                   Contents of the PROC MEANS Output Data Set                  2

                             The DATASETS Procedure

Data Set Name        WORK.TOP3LIST                     Observations          6  
Member Type          DATA                              Variables             18 
Engine               V9                                Indexes               0  
Created              18:59 Thursday, March 14, 2008    Observation Length    144
Last Modified        18:59 Thursday, March 14, 2008    Deleted Observations  0  
Protection                                             Compressed            NO 
Data Set Type                                          Sorted                NO 
Label                                                                           
Data Representation  WINDOWS                                                    
Encoding             wlatin1  Western (Windows)                                 


                       Engine/Host Dependent Information

Data Set Page Size          12288                                               
Number of Data Set Pages    1                                                   
First Data Page             1                                                   
Max Obs per Page            85                                                  
Obs in First Data Page      6                                                   
Number of Data Set Repairs  0                                                   
File Name                   filename                        
Release Created             9.0000B0                                            
Host Created                WIN_PRO                                             


                   Alphabetic List of Variables and Attributes
 
     #    Variable            Type    Len    Format       Label

     7    MoneyRaised_1       Num       8    DOLLAR8.2    Amount Raised     
     8    MoneyRaised_2       Num       8    DOLLAR8.2    Amount Raised     
     9    MoneyRaised_3       Num       8    DOLLAR8.2    Amount Raised     
     6    MoneyRaised_Mean    Num       8    DOLLAR8.2    Amount Raised_Mean
     5    MoneyRaised_Sum     Num       8    DOLLAR8.2    Amount Raised_Sum 
    10    Name_1              Char      7                                   
    11    Name_2              Char      7                                   
    12    Name_3              Char      7                                   
     4    NumberStudents      Num       8                                   
     1    School              Char      7    $SCHFMT.                       
    13    School_1            Char      7    $SCHFMT.                       
    14    School_2            Char      7    $SCHFMT.                       
    15    School_3            Char      7    $SCHFMT.                       
     2    Year                Num       8    YRFMT.                         
    16    Year_1              Num       8    YRFMT.                         
    17    Year_2              Num       8    YRFMT.                         
    18    Year_3              Num       8    YRFMT.                         
     3    _TYPE_              Num       8                                   

See the TEMPLATE procedure in SAS Output Delivery System: User's Guide for an example of how to create a custom table definition for this output data set.

Previous Page | Next Page | Top of Page