You could use the INSERT function four times, but I think it will be more efficient to allocate a 12x12 matrix of zeros and then insert the original matrix into the appropriate rows/cols as a submatrix. Both methods are shown below: proc iml; x = shape(1:100, 10); /* 1. Insert row or col of zeros */ z = j(1, 10, 0); /* row of zeros */ tmp = insert(x, z, 3); tmp = insert(tmp, z, 8); tmp = insert(x, z`, 0, 3); y = insert(tmp, z`, 0, 8); print y; /* 2. Allocate 12x12 matrix of zeros and copy x into it */ y = j(12, 12, 0); /* all zeros */ idx = setdif(1:12, {3 8}); /* gives {1 2 4 5 6 7 9 10 11 12} */ y[idx, idx] = x; print y;
... View more