Actually, if you do want to preserve the original dataset order then you must do your own remerge as in : proc sql; create table min_x_by_gs as select M.g, x, (x=minX)+(n=1) as min_x_by_g from min_ex as M inner join (select g, min(x) as minX, count(*) as n from min_ex group by g) as S on M.g=S.g; select * from min_x_by_gs; quit; try adding "g1 3" as the last line of min_ex to see the difference. PG
... View more