statistics - Weight factors by eigenvalues from PROC FACTOR in SAS? -


i trying weight factors proc factor eigenvalues, having difficulty. have solution, seems me there should more direct way this.

** factors , eigenvalues; ods output eigenvalues=myeigenvals proc factor data=mydata method=principal out=mydata;     var x1 x2 x3 x4 x5 x6; run; ods output close;  ** transpose eigenvalues; proc transpose data=myeigenvals out=myeigenvals(drop=_name_) prefix=eigenval;     id number;     var eigenvalue; run;  ** merge data , fill down eigenvalues; data mydata;     merge mydata myeigenvals;     retain e1 e2 e3 e4 e5 e6;     if _n_=1 do;         e1 = eigenval1;         e2 = eigenval2;         e3 = eigenval3;         e4 = eigenval4;         e5 = eigenval5;         e6 = eigenval6;     end;     ** weight each factor eigenvalue;     factor1 = factor1 * e1;     factor2 = factor2 * e2;     factor3 = factor3 * e3;     factor4 = factor4 * e4;     factor5 = factor5 * e5;     factor6 = factor6 * e6; run; 

as can see not seem direct way of accomplishing task. can here me fix nicely? possible?

you combine more efficiently; @ minimum, can simplify last datastep.

data mydata; if _n_=1 set myeigenvals; set mydata; array factor[6]; array eigenval[6]; _i = 1 dim(factor);   factor[_i] = factor[_i]*eigenval[_i]; end; run; 

set automatically retains variables.

secondly, may able skip multiplication depending on how you're using results. might able use weight statement use eigenvalues weights - depending on procedures you're using later analyze data. don't know if buys much, save modifying original value might preferable.


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

inno setup - TLabel or TNewStaticText - change .Font.Style on Focus like Cursor changes with .Cursor -