@MadhuKorni Fair point, that leads me to now think statistically, Please test with some intuitive combinations and let me know data have;
input name $ var1 var2 var3;
cards;
a 1 2 10
a 1 1 10
b 3 56 47
c 4 78 50
;
proc sql;
create table want(drop=std) as
select distinct name, var1, var2, var3,std(var1,var2,var3) as std
from have
group by name
having std=min(std) ;
quit; OK, The above may still cause a problem for values like a 1 2 1 a 2 1 1 This can be fixed by weigting on of the variables multiplied with a constant. For example, proc sql;
create table want(drop=std) as
select distinct name, var1, var2, var3,std(var1*2,var2,var3) as std
from have
group by name
having min(std)=std;
quit;
... View more