In reply to Darren.

Yes, permutation operations like this are used for permutation tests. The solution depends on whether you want to perform the operation in Base SAS or SAS/IML. Post your question and data to the Base SAS programming Community or to the SAS/IML Support Community.