6.6 C
London
Tuesday, March 11, 2025
HomeSASData Munging in SASHow to Normalize Data in SAS

How to Normalize Data in SAS

Related stories

Learn About Opening an Automobile Repair Shop in India

Starting a car repair shop is quite a good...

Unlocking the Power: Embracing the Benefits of Tax-Free Investing

  Unlocking the Power: Embracing the Benefits of Tax-Free Investing For...

Income Splitting in Canada for 2023

  Income Splitting in Canada for 2023 The federal government’s expanded...

Can I Deduct Home Office Expenses on my Tax Return 2023?

Can I Deduct Home Office Expenses on my Tax...

Canadian Tax – Personal Tax Deadline 2022

  Canadian Tax – Personal Tax Deadline 2022 Resources and Tools...

To “normalize” a set of data values means to scale the values such that the mean of all of the values is 0 and the standard deviation is 1. 

This tutorial explains how to normalize data in SAS.

Example: How to Normalize Data in SAS

Suppose we have the following dataset:

Perform the following steps to normalize this set of data values in SAS.

Step 1: Create the Dataset

First, let’s use the following code to create the dataset in SAS:

/*create dataset*/
data original_data;
    input values;
    datalines;
12
14
15
15
16
17
18
20
24
25
26
29
32
34
37
;
run;

/*view mean and standard deviation of dataset*/
proc means data=original_data Mean StdDev ndec=3; 
   var values;
run;

From the output we can see that the mean of the dataset is 22.267 and the standard deviation is 7.968.

Step 2: Normalize the Dataset

Next, we’ll use proc stdize to normalize the dataset:

/*normalize the dataset*/
proc stdize data=original_data out=normalized_data;
   var values;
run;

/*print normalized dataset*/
proc print data=normalized_data;
 
/*view mean and standard deviation of normalized dataset*/
proc means data=normalized_data Mean StdDev ndec=2; 
   var values;
run;

From the output we can see that the mean of the normalized dataset is 0 and the standard deviation is 1.

Step 3: Interpret the Normalized Data

SAS used the following formula to normalize the data values:

Normalized value = (x – x) / s

where:

  • x = data value
  • x = mean of dataset
  • s = standard deviation of dataset

Each normalized value tells us how many standard deviations the original data value was from the mean.

For example, consider the data point “12” in our original dataset. The original sample mean was 22.267 and the original sample standard deviation was 7.968.

The normalized value for “12” turned out to be -1.288, which was calculated as:

Normalized value = (x – x) / s = (12 – 22.267) / 7.968 = -1.288

This tells us that the value “12” is 1.288 standard deviations below the mean in the original dataset.

Each of the normalized values in the dataset can help us understand how close or far a particular data value is from the mean.

A small normalized value indicates that a value is close to the mean while a large normalized value indicates that a value is far from the mean.

Additional Resources

The following tutorials explain how to perform other common tasks in SAS:

How to Use Proc Summary in SAS
How to Calculate Correlation in SAS
How to Create Frequency Tables in SAS

Subscribe

- Never miss a story with notifications

- Gain full access to our premium content

- Browse free from up to 5 devices at once

Latest stories