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...
Data Analysis [9-15]


OUTPUT Statement
You can also create an output data set for the analysis results.

Example

Locate the CARS data set from the SASHelp library.

Now, let's compute the summary statistics on the MSRP variable.

Proc Means Data=SASHelp.cars;
Var MSRP;
Output Out=MSRP_Stat Mean=Mean STD=STD;
Run;
Picture
The OUTPUT statement is similar to the one from Proc Univariate.

It tells SAS to create a new data set for the analysis results.
Picture

​You can also specify the statistics to be computed by listing the statistics keywords:
Picture

​The MSRP_Stat data set contains the mean and standard deviation as requested in the OUTPUT statement.
Picture

Exercise

Copy and run the NUM data set below:

The NUM data set contains a population of 10 data points.

A z-score is a measure of the number of standard deviation above or below the mean.

It can be calculated as:

z = x - µ/σ where

x = the value to be standardized
µ = the mean 
σ = the standard deviation

Compute the z-score for each data points.
Next

Need some help? 


HINT:
First, compute the mean and the standard deviation of the population. Then calculate the z-score based on the formula.


SOLUTION:
Data Num2;
Set Num;
i = 1; *Create an arbitrary variable for merging purpose;
Run;

proc means data=num2 noprint;
Var Rnumber;
By i;
Output out=stat mean=mean std=std;
run;

Data Zscore;
Merge Num2 Stat;
By i;
Zscore = (Rnumber - Mean)/std;
Run;

Note: z-score can also be computed using Proc Standard.


Fill out my online form.

Already a member? Go to member's area.