data car;
infile datalines dsd;
input brand $ loan ;
datalines;
mini,70
,30
,20
,10
toyota,80
,40
;
run;
data have;
set car;
if not missing(brand) then group+1;
run;
data want;
sum=0;
do until(last.group);
set have;
by group;
if not first.group then sum+loan;
end;
do until(last.group);
set have;
by group;
if first.group then loan=loan-sum;
output;
end;
drop sum group;
run;
... View more