The STDIZE Procedure
Example 3: Replacing Missing Values with Standardizing
Features
Setting the METHOD= Standardize Statistic
q
Using the REPLACE option
q
This example demonstrates how to replace missing values and standardize selected numeric variables in the
SAMPSIO.HMEQ (home equity) data set. When you use the REPLACE option in conjunction with the METHOD=
location option, the STDIZE procedure replaces and standardizes the numeric variables.
Because the STDIZE procedure only replaces missing numeric values, a predecessor SAS DATA step is used to
replace the missing character values with the variable's mode.
Program
proc freq data=sampsio.hmeq;
tables reason job;
run;
data hmeq;
set sampsio.hmeq;
if reason=' ' then reason='DebtCon';
if job=' ' then job='Other';
run;
proc stdize data=hmeq
out=rshmeq
method=mean
replace;
var mortdue value yoj derog delinq
clage ninq clno debtinc;
title 'Impute and Standardize';
run;
proc print data=rshmeq(obs=10);
title 'Partial Listing of the Imputed/Standardized Data Set';
run;
proc print data=hmeq(obs=10);
title 'Partial Listing of the Input Data Set';
run;
Output
PROC FREQ Frequency Table of the Home Equity Character Variables
Partial Listing of the Input Data Set
Cumulative Cumulative
REASON Frequency Percent Frequency Percent
-----------------------------------------------------
DebtCon 3928 68.8 3928 68.8
HomeImp 1780 31.2 5708 100.0
Frequency Missing = 252
Cumulative Cumulative
JOB Frequency Percent Frequency Percent
-----------------------------------------------------
Mgr 767 13.5 767 13.5
Office 948 16.7 1715 30.2
Other 2388 42.0 4103 72.2
ProfExe 1276 22.5 5379 94.7
Sales 109 1.9 5488 96.6
Self 193 3.4 5681 100.0
Frequency Missing = 279
PROC PRINT Partial Listing of the Imputed/Standardized Data Set and the
Input Data Set
Partial Listing of the Imputed/Standardized Data Set
OBS BAD LOAN MORTDUE VALUE REASON JOB YOJ
1 1 1100 -47900.82 -62751.05 HomeImp Other 1.57773
2 1 1300 -3707.82 -33376.05 HomeImp Other -1.92227
3 1 1500 -60260.82 -85076.05 HomeImp Other -4.92227
4 1 1500 0.00 0.00 DebtCon Other 0.00000
5 0 1700 24039.18 10223.95 HomeImp Office -5.92227
6 1 1700 -43212.82 -61456.05 HomeImp Other 0.07773
7 1 1800 -25111.82 -44739.05 HomeImp Other -3.92227
8 1 1800 -45258.82 -58742.05 HomeImp Other 2.07773
9 1 2000 -41060.82 -55036.05 HomeImp Other -5.92227
10 1 2000 0.00 -39526.05 HomeImp Sales 7.07773
OBS DEROG DELINQ CLAGE NINQ CLNO DEBTINC
1 -0.25457 -0.44944 -85.400 -0.18606 -12.2961 0.00000
2 -0.25457 1.55056 -57.933 -1.18606 -7.2961 0.00000
3 -0.25457 -0.44944 -30.300 -0.18606 -11.2961 0.00000
4 0.00000 0.00000 0.000 0.00000 0.0000 0.00000
5 -0.25457 -0.44944 -86.433 -1.18606 -7.2961 0.00000
6 -0.25457 -0.44944 -78.300 -0.18606 -13.2961 3.33370
7 2.74543 1.55056 -102.666 -0.18606 -4.2961 0.00000
8 -0.25457 -0.44944 -91.000 -1.18606 -13.2961 3.10498
9 -0.25457 1.55056 37.167 -0.18606 -9.2961 0.00000
10 -0.25457 -0.44944 -63.966 -1.18606 -8.2961 0.00000
Partial Listing of the Input Data Set
M D
O R D E
R V E D E C B
L T A A E L L N C T
O B O D L S J Y R I A I L I
B A A U U O O O O N G N N N
S D N E E N B J G Q E Q O C
1 1 1100 25860 39025 HomeImp Other 10.5 0 0 94.367 1 9 .
2 1 1300 70053 68400 HomeImp Other 7.0 0 2 121.833 0 14 .
3 1 1500 13500 16700 HomeImp Other 4.0 0 0 149.467 1 10 .
4 1 1500 . . DebtCon Other . . . . . . .
5 0 1700 97800 112000 HomeImp Office 3.0 0 0 93.333 0 14 .
6 1 1700 30548 40320 HomeImp Other 9.0 0 0 101.466 1 8 37.1136
7 1 1800 48649 57037 HomeImp Other 5.0 3 2 77.100 1 17 .
8 1 1800 28502 43034 HomeImp Other 11.0 0 0 88.766 0 8 36.8849
9 1 2000 32700 46740 HomeImp Other 3.0 0 2 216.933 1 12 .
10 1 2000 . 62250 HomeImp Sales 16.0 0 0 115.800 0 13 .
Copyright 2000 by SAS Institute Inc., Cary, NC, USA. All rights reserved.