Hi @Tamino,
If you want to preserve the order of observations, you can use either of the suggested PROC SQL steps with an ORDER BY clause like this
order by input(compress(id,'x'),32.),year,count;
or use a DATA step:
data want;
do _n_=1 by 1 until(last.id);
set dataset_have;
by id notsorted;
n_count=max(n_count,count);
end;
do _n_=1 to _n_;
set dataset_have;
output;
end;
run;
Note that your DATASET_HAVE is not sorted (but only grouped) by ID, which is why I used the NOTSORTED option in the BY statement above.
... View more