Saturday, February 03, 2007

Factor Analyses with Sas

In the beginning of the process we have to transpose the data in order to receive one column to each category.
proc transpose data =jjj1 out=toz prefix=peul;
by branch_cust_ip;
id Event_Costing_Activity_Type_Co;
var count;
run;

We want fill missing values with 0:


data toz;
set toz;
array toz{*} _NUMERIC_ ;
do i = 1 to dim(toz);
if toz{i} = . then toz{i} = 0;
end;
drop i;
run;

Definition of factors:
proc factor score data=rehishot.ishit method=p rotate=orthomax nfactors=10 outstat=fact_ish;
var peul: ;
run;
Scoring of the data:
proc score data=rehishot.ishit score=fact_ish out=scores_ishit;
var peul: ;
run;

In the end we want to find the most influent (max Factor)
and the less influent (min Factor)
data scores_ishit;
set scores_ishit ;
max=max(Factor1,Factor2,
Factor3,Factor4,Factor5,
Factor6,Factor7,Factor8,
Factor9,Factor10)
;
min=min(Factor1,Factor2,
Factor3,Factor4,Factor5,
Factor6,Factor7,Factor8,
Factor9,Factor10)
;
run;

data scores_ishit;
set scores_ishit;
array factor Factor1-factor10;
do i=1 to dim(factor);
if max=factor [i] then factor_max=i;
if min=factor [i] then factor_min=i;
end;
run;

No comments: