The same idea with PGStats.
data have;
call streaminit(123456789);
do id=1 to 5000;
r=ceil(5*rand('uniform'));
cum_r+r;
output;
end;
run;
proc sql noprint;
select sum(r) into : sum
from have;
quit;
data temp;
set have end=last;
cum_x=ceil(25000*cum_r/&sum);
run;
data want;
set temp;
x=dif(cum_x);
if _n_=1 then x=cum_x;
keep id x;
run;
proc means data=want sum;
var x;
run;
proc freq data=want;
table x;
run;