data add_ob;
*use the end=last to tell us when we have reached the last observation;
set original end=last;
*output every observation we have already;
output;
*and when we have output the last original;
if last then do;
*create the values;
Id='Sum';
Amount=3800;
*and output another observation;
output;
end;
run;
[pre]
data have;
input Id:$1. Amount;
cards;
Q 1200
W 1500
E 1100
;;;;
run;
data sum;
length ID $3; * "Sum" won't fit in $1;
do while(not eof);
set have end=eof;
output;
sum + amount;
end;
id = 'Sum';
amount = sum;
output;
stop;
drop sum;
run;
proc print;
run;
[/pre]