options ls=85 ps=75;

title 'SAS Factor Analysis Example 4';

 

data stock;

  obs='*';

  infile 'D:\T8-4.DAT';

  input AlliedChemical Dupont UnionCarbide Exxon Texaco;

run;

 

proc print data=stock;

run;

 

proc factor method=prin res scree;

  title2 'Principal Component Method';

run;

 

*proc factor method=prin n=2 res;

* title2 'Principal Component Method nfactor=2';

*run;

 

proc factor method=prin n=2 priors=smc res;

  title2 'Principal Factor Method nfactor=2';

run;

 

/*Iterative method for estimation*/

 

proc factor method=prinIT priors=smc res;

  title2 'ITERATIVE Principal Factor Method';

run;

 

proc factor method=prinIT priors=smc n=2 res;

  title2 'ITERATIVE Principal Factor Method nfactor=2';

run;

 

proc factor method=ml n=1 res;

  title2 'MLE: nfactor=1';

run;

 

proc factor method=ml n=2 res;

  title2 'MLE: nfactor=2';

run;

 

proc factor method=ml n=3 res;

  title2 'MLE: nfactor=3';

run;

 

 

/*Factor Ratation*/

proc factor method=ml n=2 res rotate=varimax preplot plot;

  title2 'MLE: rotate=varimax';

run;

 

proc factor method=ml n=2 res rotate=HK preplot plot;

  title2 'MLE: rotate=HK';

run;

 

proc factor method=ml n=2 res rotate=promax preplot plot out=fscore;

  title2 'MLE: rotate=promax';

run;

 

proc print data=fscore;

run;

 

title2 "scatter plot of factor scores for factor1 and factor2";

%plotit(data=fscore,labelvar=obs, plotvars=factor2 factor1, color=black, colors=blue);

run;

 

 

proc factor data=stock method=prin priors=asmc nfact=3 rotate=varimax out=fscore1;

run;

 

proc print data=fscore1;

run;

 

title2 "scatter plot of factor scores for factor1 and factor3";

%plotit(data=fscore1,labelvar=obs, plotvars=factor3 factor1 ,color=black, colors=blue);

run;