SAS PROGRAMMING HANDOUT #24 This handout uses PROC IML to diagonize a symmetric matrix: PROC IML; A={1 2 3,4 5 6,5 7 9}; * this inputs a matrix; PRINT A; G=GINV(A); * this is the generalized inverse; PRINT G; B=A`*A; PRINT B; CALL EIGEN(M,E,B); * this computes the eigenvalues of B; PRINT M; * M is a vector of eigenvalues; PRINT E; * E is a matrix whose columns are; M=FUZZ(M); PRINT M; BB=E*DIAG(M)*E`; * orthogonal eigenvectors; PRINT BB; RUN; The following PROC IML program illustrates various functions. PROC IML; C = {1 2 3,4 5 6}; PRINT C; *makes a 2x3 matrix; D = DIAG( C[,2] ); PRINT D; *puts second column of c on diagonal; CC= VECDIAG(D); PRINT CC; *makes a vector out of the diagonal; DD = EXP(D); PRINT DD; *exponentiates each entry; E = C || C; PRINT E; *puts c next to itself; F = C // SHAPE(2,1,3) ; PRINT F; *puts a row of 2's below C; G = 3+3*(C[,2:3]##3); PRINT G; *raises each entry of columns 2 & 3 of C to the third power then multiples by 3 and adds 3; H = C ## C; PRINT H; *raises each entry of C to itself; J = C # C; PRINT J; *multiplies each entry of C by itself; RUN;