To standardize variables in SAS, you can use
**proc standard**. The example shown below creates a data file **cars** and
then uses **proc standard** to standardize **weight** and **price**.

DATA cars; INPUT mpg weight price ; DATALINES; 22 2930 4099 17 3350 4749 22 2640 3799 20 3250 4816 15 4080 7827 ; RUN; PROC STANDARD DATA=cars MEAN=0 STD=1 OUT=zcars; VAR weight price ; RUN; PROC MEANS DATA=zcars; RUN;

The **mean=0** and **std=1**
options are used to tell SAS what you want the mean and standard deviation to be for the
variables named on the **var** statement. Of course, a mean of 0 and
standard deviation of 1
indicate that you want to standardize the variables. The **out=zcars** option
states that the output file with the standardized variables will be called **zcars**.

The **proc means** on **zcars**
is used to verify that the standardization was performed properly. The output below
confirms that the variables have been properly standardized.

Variable N Mean Std Dev Minimum Maximum ------------------------------------------------------------------- MPG 5 19.2000000 3.1144823 15.0000000 22.0000000 WEIGHT 5 -4.44089E-17 1.0000000 -1.1262551 1.5324455 PRICE 5 -4.44089E-17 1.0000000 -0.7835850 1.7233892 -------------------------------------------------------------------

Often times you would like to have both the standardized
variables and the unstandardized variables in the same data file. The example below shows
how you can do that. By making extra copies of the variables **zweight** and
**zprice**,
we can standardize those variables and then have **weight** and **price**
as the unchanged values.

DATA cars2; SET cars; zweight = weight; zprice = price; RUN; PROC STANDARD DATA=cars2 MEAN=0 STD=1 OUT=zcars; VAR zweight zprice ; RUN; PROC MEANS DATA=zcars; RUN;

As before, we use **proc means** to confirm
that the variables are properly standardized.

Variable N Mean Std Dev Minimum Maximum ------------------------------------------------------------------- MPG 5 19.2000000 3.1144823 15.0000000 22.0000000 WEIGHT 5 3250.00 541.6179465 2640.00 4080.00 PRICE 5 5058.00 1606.72 3799.00 7827.00 ZWEIGHT 5 -4.44089E-17 1.0000000 -1.1262551 1.5324455 ZPRICE 5 -4.44089E-17 1.0000000 -0.7835850 1.7233892 -------------------------------------------------------------------

As we see in the output above, **zweight**
and **zprice** have been standardized, and **weight** and **price**
remain unchanged.