I assume that 3rd submatrix: 21 22 23 24 22 25 26 27 23 26 28 29 24 27 29 30 I also assume that table is a sas dataset: data table; input v1-v4; cards; 3.201 0.104 7.66 -6.77 -2.09 6.14 2.54 -1.06 0.36 2.36 -1.05 1.8 0.89 -0.36 -1.25 -0.08 1.2 2.36 0.65 -0.19 0.44 -0.47 0.54 1.25 -0.04 1.78 -0.15 1.36 0.13 -0.54 1.23 1.11 ; run; I developed the following solution that creates 3 SAS datasets: Submatrix1, Submatrix2 and Submatrix3: data submatrix1(keep=colA:) submatrix2(keep=colB:) submatrix3(keep=colC:); array vector(32); array MatrixA(4,4); array MatrixB(4,4); array MatrixC(4,4);: array ColA(4); array ColB(4); array ColC(4); retain x 0; do until (eof); set table end=eof; vector(x+1)=v1; vector(x+2)=v2; vector(x+3)=v3; vector(x+4)=v4; x+4; end; do i=1 to 4; do j=1 to 4; if min(i,j)=1 and (i=1 or j=1) then MatrixA(i,j)=max(i,j); else if min(i,j)=2 and (i=2 or j=2) then MatrixA(i,j)=i+j+1; else MatrixA(i,j)=i+j+2; end; end; do i=1 to 4; do j=1 to 4; MatrixB(i,j)=MatrixA(i,j)+10; MatrixC(i,j)=MatrixA(i,j)+20; end; end; do i=1 to 4; do j=1 to 4; n=MatrixA(i,j); colA(j)=vector(n); n=MatrixB(i,j); colB(j)=vector(n); n=MatrixC(i,j); colC(j)=vector(n); end; output submatrix1; output submatrix2; output submatrix3; end; run; Is this what you need?
... View more