In reply to Brian.

Do you know about the SAS Discussion Forums at http://communities.sas.com/ ? There's one for SAS/IML, one for DATA step programming, etc. I don't see any SAS/IML in your or Charlie's example, so you might try the Macro/SQL/Data Step forum at http://communities.sas.com/community/sas_macro_facility_data_step_and_sas_language_elements
These are a valuable resource for people like you who are learning SAS.

If you really want to do this in SAS/IML, you can post your question to the SAS/IML forum, but you'll need to provide more details about what you have and what you want. Data for a short example will encourage more people to take a look at the question.