Search the site...

SASCRUNCH TRAINING
  • Home
  • Member's Area
  • How to Start
  • SAS Interface
  • Creating a Data Set
  • Practical SAS Training Course
  • SAS Certified Specialist Training Program
  • Proc SQL Course
  • Introduction to Time Series Analysis
  • SAS Project Training Course
  • Full Training / Membership
  • Sign up
  • About us
  • Contact us
  • Home
  • Member's Area
  • How to Start
  • SAS Interface
  • Creating a Data Set
  • Practical SAS Training Course
  • SAS Certified Specialist Training Program
  • Proc SQL Course
  • Introduction to Time Series Analysis
  • SAS Project Training Course
  • Full Training / Membership
  • Sign up
  • About us
  • Contact us
Sentry Page Protection
Please Wait...
Proc Means [3-3]
SAS Base Exam


Class Statement
The Class statement allows you to group the data for your analysis.

Example

​Copy and run the WINE data set from the yellow box below.
Picture

A brand of wine was being rated by a group of 15 critics. The results are captured in the WINE data set.

The WINE data set contains the following data:
  • ID: Critics ID
  • GENDER: the gender of the critics
  • AGE: the age of the critics
  • RATING: the rating of the wine

Let's run the MEANS procedure on the RATING variable. 

By default, the MEANS procedure computes the statistics across the entire column.

Example
Proc Means Data=Wine;
Var Rating;
Run;
Picture

The MEANS procedure computes the statistics across all of the 15 observations.

What if you want to look at the statistics by the two genders?

Simply add the CLASS statement and specify GENDER as the classification variable.

Example

​Proc Means Data=Wine;
Var Rating;
​Class Gender;

Run;
Picture

The CLASS statement is added to the MEANS procedure.

The analysis is now separated by the two genders.
Picture


Output Statement

By default, the analysis results are displayed on the Results window (for SAS Studio).
Picture

More often than not, you might want to save the results in an actual data set for further analysis.

This can be done by using the Output statement. 

Example

Proc Means Data=Wine;
Var Rating;
Class Gender;
Output out = Stat;
Run;
Picture

The Output statement creates an output data set called STAT that can be located in the WORK library.
Picture

The STAT data set contains the analysis results from Proc Means.
Picture

Exercise
Compute the mean and standard deviation of the wine rating by the gender and age group. Display the statistics in 2 decimal places.
Next

Need some help? 
​
Get Hint
Get Solution
Fill out my online form.

Home 
​
1 2 3 4 5 6 7
Summary | Final Test | Coding Exercises
Coding Project

Already a member? Go to member's area.