Posted by : Netbloggy Friday, October 2, 2015

As we mentioned in the previous post, PROC MEANS is our handy option to create a new summary dataset that can be used in other data steps or Procedures. Here we'll show how to create a summary dataset using PROC MEANS.

Problem:

Using the SAS data set College, create a summary data set (call it Class_Summary) containing the n, mean, and median of ClassRank and GPA for each value of SchoolSize. Use a CLASS statement and be sure that the summary data set only contains statistics for each level of SchoolSize. Use the AUTONAME option to name the variables in this data set.

Solution:


 
/* create summary dataset from proc means */
/* NWAY to display only the Schoolsize level type */
proc means data=A15001.A01_College NOPRINT NWAY;
    CLASS SchoolSize;
    var ClassRank GPA;
    Output out=A15001.A01_Class_Summary N=Mean=Median= /Autoname;
run;
 
Title 'Grouped Summary Statistics of ClassRank & GPA by Schoolsize';
 
proc print data=A15001.A01_Class_summary;
run;
 
Title;

Output:


Learning:
  • How to efficiently use PROC MEANS to create a summary dataset
  • What's the purpose of NWAY option in PROC MEANS
  • How to automatically name the variables in the newly created Summary dataset



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 -