What are the options of using PROC STDIZE in SAS?

Are you looking to learn how to use PROC STDIZE in SAS? This tutorial will provide a step-by-step guide on how to use this procedure in SAS, and will include a sample example that you can use to help understand the process. We will also cover what PROC STDIZE is used for and why it is so important in data analysis. By the end of this tutorial, you will have a better understanding of how to use PROC STDIZE and be able to perform data analysis with confidence.


To standardize a variable means to scale each of the values for the variable such that the mean value is 0 and the standard deviation is 1.

You can use the following formula to standardize a variable

(xix) / s

where:

  • xi: The ith value in the dataset
  • x: The sample mean
  • s: The sample standard deviation

The easiest way to standardize a variable in SAS is to use the PROC STDIZE statement.

The following example shows how to use this statement in practice.

Example: How to Use PROC STDIZE in SAS

Suppose we have the following dataset in SAS that contains information about various basketball players:

/*create first dataset*/ 
data my_data;
    input player $ points assists rebounds;
    datalines;
A 18 3 15
B 20 3 14
C 19 4 14
D 14 5 10
E 14 4 8
F 15 7 14
G 20 8 13
H 28 7 9
I 30 6 5
J 0 31 9 4
;
run;

/*view dataset*/
proc print data=my_data;

We can use the PROC STDIZE statement to create a new dataset that standardizes each of the numeric variables in the dataset:

/*standardize all numeric variables in dataset*/
proc stdize data=my_data out=std_data;
run;

/*view new dataset*/
proc print data=std_data;

Each of the numeric variables (points, assists, rebounds) have been standardized to have a mean of 0 and standard deviation of 1.

Note that we can also use the VAR statement to specify which variables to standardize.

For example, we can use the following PROC STDIZE statement with the VAR statement to only standardize the points variable:

/*standardize points variable in dataset*/
proc stdize data=my_data out=std_data;
    var points;
run;

/*view new dataset*/
proc print data=std_data;

The values in the points column have been standardized while all other columns have remained untouched.

We can use the PROC MEANS statement to verify that the points variable now has a mean value of 0 and a standard deviation of 1:

/*view mean and standard deviation of each variable*/
proc means data=std_data;

We can see that the points variable indeed has a mean value of 0 and a standard deviation of 1.

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

x