In reply to SASIML.

Chloe,
I suggest that your program will be simpler if you get rid of the macro %DO loop and use WHERE processing in SAS/IML instead. For an example, see my article "BY-group processing in SAS/IML." It will then be easy for you to use regular DO loops to loop over the YEAR and MONTH variables and fill in the elements of your array.