In reply to Farhad.

In your example, you have all of the data and the J column changes faster than the I column. In that case, you just need to reshape the vector Y into a matrix:
Y = shape(Y, max(i), max(j));
Fort more complicated examples with missing indices, post your question and example data to the SAS/IML Support Forum.