I should add, I tried seperating out the lines with the max total and the location and joining back to the original but that was no good. Code looked like this: data e1 (drop=count); set e; by Location; if first.Location then count=1; do ct = count; end; count+1; If last.Location then x = ct; run; proc sql; create table forjoin as select Location, ct from e1 where x <> .; run; proc sql; create table e2 as select * from e1 left join forjoin on e1.location = forjoin.location; quit;
... View more