Hi all, im using the following code for obtaining eigenvalues / vectors for deriving principal components . My data-lines have a covariance matrix. data have(type=cov); /* leave off a lot of the TYPE=COV data for simplicity */ _type_='COV'; input m1 m2 m3 m4; datalines; 18.8767 26.8567 7.5550 -5.1533 26.8567 47.2433 5.1033 -15.2300 7.5550 5.1033 92.1900 58.8983 -5.1533 -15.2300 58.8983 48.5233 ; ods select eigenvalues eigenvectors; proc princomp data=have(TYPE=COV) cov; run; proc iml; use have; read all var _NUM_ into M; close; eigm=eigval(m); print eigm; It works perfectly but what do i need to do while trying to use a correlation matrix ? when i change the cov to cor i get an error that the system is not expecting COR So I tried the code below but this throws an error ERROR: (execution) Matrix should be square. ERROR: Matrix eigvals has not been set to a value. proc iml; sigma={1.00000 0.89933 0.18110 -0.17027 0.89933 1.00000 0.07733 -0.31809 0.18110 0.07733 1.00000 0.88061 -0.17027 -0.31809 0.88061 1.00000}; eigvals=eigval(sigma); eigvec=eigvec(sigma); print eigvals; print eigvec; Many thanks.
... View more