I am trying to get as a macro variable or a plain variable the number of the observation that is the min/max of one variable.
I can get easily the value of this min/max, via a proc sql
proc sql noprint;
select min(variable) into :minvariable
from have;
quit;
Or via a proc summary
proc summary data=want;
var variable;
output out=mintable min=minvariable;
run;
But I have not fouhd in either method an easy way to find the number of the observation this minimum corresponds to.
Background : I want to separate my sorted database based on this observation number, because I know that sorted in the right way there is a global minimum, and my variable of interest follows a U-curve