There are two SAS functions—one for each—to compute the eigenvalues and to compute the eigenvectors of a symmetric matrix. These are EIGVAL and EIGVEC respectively. For the symmetric matrix denoted by SYM and given as,
the statements
sym ={4 2, 2 4}; eval_sym = eigval(sym) evec_sym = eigvec(sym); print eval_sym,evec_sym;
produce the desired eigenvalues and eigenvectors.
The subroutine EIGEN will achieve both tasks in a single call. The corresponding statement is
call eigen(lambda,p,sym); print lambda,p;
The eigenvalues and respective eigenvectors are stored in A and P. Columns of P are the eigenvectors.
3.145.204.201