the second datastep is showing you that the result are in the table on the last observation
but understanding this step is not trivial and need a 'sum' of practice.
infile cards ;
input id tot; retain one two 0;
if tot=1 then one+id;
if tot=2 then two+id;
set x nobs=l point=l;
put one= two= ;