记数据列为变量,行为观测
1 依据观单独的测值均值作标准化,公式形如:(变量值-观测均值)/观测均值
data stocks;
set sashelp.stocks;
array m{*} open high low close adjclose;
array m_mean{*} open high low close adjclose;
m_avg= mean (of open high low close adjclose);
do i=1 to dim(m);
m_mean{i}=((m{i}-m_avg)/m_avg);
end;
drop i;
run;
2 根据某个条件下的所有观测值均值作标准化,该条件可以为时期、分类变量等等
data stocks1;
set sashelp.stocks;
run;
proc means data=stocks1 ;
var open high low close adjclose;
class stock;
output out=m_mean mean= / autoname;
run;
data stocks1;
set stocks1 ;
if stock="IBM" THEN
open=open/102.65;
run;
3 PROC STDIZE Procedure
PROC STDIZE < options > ;
BY variables ;
FREQ variable ;
LOCATION variables ;
SCALE variables ;
VAR variables ;
WEIGHT variable ;