SAS Examples

Instructor:  Joshua D. Naranjo
E-mail: joshua.naranjo@wmich.edu
Phone: (269)387-4548
Office: 5507 Everett Tower
How to Calculate Means and SDs:

  1. Three ways to summarize numerical data

    • PROC UNIVARIATE is easy to use and gives plenty of estimates and tests for numerical variables.
    • PROC MEANS is easy to use and has a more compact and readable output than UNIVARIATE.
    • PROC TABULATE is the most useful because it allows the user to customize tables of summary statistics. It outputs professional looking tables, ready for inclusion in reports or publications.

  2. Example
                   
        DATA homes;                              
               INPUT price sqft age;             
               priceT=price/1000;                
               DATALINES;
        205000 2650 13
        215000 2664  6
        215000 2921  3
        199900 2580  4
        190000 2580  4
        180000 2774  2
        156000 1920  1
        137500 1837  4
        127000 1880  8
        125000 2150 15
        123500 1894 14
        117000 1928 18
        ;                                        
    
        PROC UNIVARIATE DATA=homes;
                VAR price sqft age;
        RUN;
        
        PROC MEANS DATA=homes;
                VAR price sqft age;
        RUN;
        
        PROC TABULATE DATA=homes;
                VAR price sqft age;
                TABLE (price sqft age),(N MEAN STD);
        RUN;
    
        QUIT;
    
    

 

Department of Statistics
3304 Everett Tower
Western Michigan University
Kalamazoo MI 49008-5152 USA
(269) 387-1420 | (269) 387-1419 Fax
stat-webmaster@wmich.edu