There you go
data have;
input id aesoc $ aeterm :$30. Count;
infile datalines dlm=',';
datalines;
1,Heart,Atrial fibrillation,25
1,Heart,Cardiac arrest,27
2,Ear,Deafness,10
2,Ear,Ear Pain,5
;
data want(drop=sum);
do until (last.id);
set have;
by id;
sum=sum(sum, count);
end;
Count=sum;aeterm=aesoc;rec_add='Y';
output;
rec_add='';
do until (last.id);
set have;
by id;
output;
end;
run;