In reply to Abdulbaki Bilgic.

Yes, you can do that. That technique is inefficient for large dimenions, which I point out at http://blogs.sas.com/content/iml/2012/02/22/how-to-compute-mahalanobis-distance-in-sas/. My intention was for you to cut and paste the Mahalanobis function from that URL. However, for small dimensions, your technique is fine and is simpler.

Thanks for catching the typo. It is fixed.