I have to admit, that given your explanation, there seem to be some steps missing in my mind in order to make sense of your code.
Nevertheless, it seems to me that you can use PROC STDIZE to subtract the mean from each variable. In the resulting data set, the reading closest to zero in absolute value is the one you want (I think).
... View more