Sentry Page Protection
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;
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;
The OUTPUT statement is similar to the one from Proc Univariate.
It tells SAS to create a new data set for the analysis results.
It tells SAS to create a new data set for the analysis results.
You can also specify the statistics to be computed by listing the statistics keywords:
The MSRP_Stat data set contains the mean and standard deviation as requested in the OUTPUT statement.
Exercise
Copy and run the NUM data set below:
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.
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.