Posted by : Netbloggy Friday, October 2, 2015

We've seen the basic data manipulation options with SAS in our previous blogpost and it's time for us to understand how to report those processed data. And the first think that comes in this journey is PROC MEANS.

People think of PROC MEANS just as a way to calculate summary statistics of numeric values but these procedures are much more versatile and can be used to create summary data sets that can then be analyzed with more DATA or PROC steps.

Problem 1:

Using the SAS data set College, compute the mean, median, minimum, and maximum and the number of both missing and non-missing values for the variables ClassRank and GPA. Report the statistics to two decimal places. (Ref: Learning SAS by Example, Ron Cody, Chapter 16, Problem 1)

Input Data:


Solution:

 
Title 'Summary Statistics of ClassRank & GPA with two decimal pts';
 
proc means data=A15001.A01_College Mean Median Min Max NMiss N Maxdec=2;
    var ClassRank GPA;
run;
 
Title;

Output:

 

Problem 2:

Repeat Problem 1, except compute the desired statistics for each combination of Gender SchoolSize. Do this twice, once using a BY statement, and once using a CLASS statement.

Solution:

 
Title 'Grouped Summary Statistics of ClassRank & GPA with two decimal pts';
 
proc means data=A15001.A01_College Mean Median Min Max NMiss N Maxdec=2;
    Class Gender SchoolSize;
    var ClassRank GPA;
run;
 
Title;
 
/* Grouping with BY */
proc sort data=A15001.A01_College out=sorted_college;
    by Gender Schoolsize;
run;
 
Title 'Grouped Summary Statistics of ClassRank & GPA with two decimal pts';
 
proc means data=sorted_college Mean Median Min Max NMiss N Maxdec=2;
    by Gender SchoolSize;
    var ClassRank GPA;
run;
 
Title;

Output:




Learning:


  • Different ways of using PROC MEANS
  • Various options of PROC MEANS like MAXDEC
  • Grouping PROC MEANS Summary statistics


Leave a Reply

Subscribe to Posts | Subscribe to Comments

Popular Post

Blogger templates

Total Pageviews

Powered by Blogger.

- Copyright © nulldata -Metrominimalist- Powered by Blogger - Designed by Johanes Djogan -