Hi everyone, I am wondering how to find the matched observation with nearest Mahalanobis distance.

Saying I have 50 schools (50 rows in my data) , with 5 continuous variables(X1-X5) in each row , indicating the 5 aspects of each school.

I chose 10 schools,saying A1-A10, as the treated school from the 50 schools randomly.

Then I would like to find the corresponding matched school (saying B1- B10) for each treated school .

For each pair of schools , they have the nearest Mahalanobis distance in terms of the 5 aspects of the school,X1-X5, meaning that the distance( with regard to X1-X5) is the nearest between B1 and A1 than the distance between any other school and A1.

How could I find all the matched schools ?

Thank you~