How to use PROC STDIZE in SAS with an example? 2

How to use PROC STDIZE in SAS with an example?

PROC STDIZE is a SAS procedure that allows users to standardize numerical variables, also known as z-score transformation, in order to make them comparable and easier to analyze. This procedure is particularly useful when dealing with data that has a wide range of values and helps to remove any potential biases caused by extreme values.

To use PROC STDIZE in SAS, the first step is to specify the variables that need to be standardized in the VAR statement. Users can choose to standardize all variables or specific ones by listing their names. Next, the METHOD statement should be used to select the type of standardization desired, such as mean-centered or range-standardized. Finally, the OUTPUT statement can be used to create a new dataset with the standardized variables.

For example, if we have a dataset with three numerical variables, “height,” “weight,” and “age,” and we want to standardize all three, we can use the following code:

PROC STDIZE DATA = original_data OUT = standardized_data;
VAR height weight age;
METHOD = MEAN;
RUN;

This will create a new dataset called “standardized_data” with the three variables standardized using the mean-centered method. This allows us to compare the values of each variable on the same scale, making it easier to identify patterns and relationships in the data.

In conclusion, PROC STDIZE in SAS is a powerful tool for standardizing numerical variables and improving the accuracy and reliability of data analysis. It is essential for any researcher or analyst working with large and diverse datasets.

Use PROC STDIZE in SAS (With Example)


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 printdata=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 stdizedata=my_data out=std_data;
run;

/*view new dataset*/
proc printdata=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 stdizedata=my_data out=std_data;
    var points;
run;

/*view new dataset*/
proc printdata=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 meansdata=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:

Cite this article

stats writer (2024). How to use PROC STDIZE in SAS with an example?. PSYCHOLOGICAL SCALES. Retrieved from https://scales.arabpsychology.com/stats/how-to-use-proc-stdize-in-sas-with-an-example/

stats writer. "How to use PROC STDIZE in SAS with an example?." PSYCHOLOGICAL SCALES, 23 Jun. 2024, https://scales.arabpsychology.com/stats/how-to-use-proc-stdize-in-sas-with-an-example/.

stats writer. "How to use PROC STDIZE in SAS with an example?." PSYCHOLOGICAL SCALES, 2024. https://scales.arabpsychology.com/stats/how-to-use-proc-stdize-in-sas-with-an-example/.

stats writer (2024) 'How to use PROC STDIZE in SAS with an example?', PSYCHOLOGICAL SCALES. Available at: https://scales.arabpsychology.com/stats/how-to-use-proc-stdize-in-sas-with-an-example/.

[1] stats writer, "How to use PROC STDIZE in SAS with an example?," PSYCHOLOGICAL SCALES, vol. X, no. Y, ص Z-Z, June, 2024.

stats writer. How to use PROC STDIZE in SAS with an example?. PSYCHOLOGICAL SCALES. 2024;vol(issue):pages.

Download Post (.PDF)
Slide Up
x
PDF
Scroll to Top