I need to use SAS to answer the following:
I was able to generate E(M) with the following code:
data prob1;
call streaminit (33);
do i=1 to 10000;
sum=0 ;
M=0 ;
do until (sum>1) ;
xuni = rand('uniform', 0, 1);
sum+xuni;
M+1 ;
end ;
output;
end;
run;
proc means data=prob1;
var M;
run;
But I am completely lost as to whether or not there is convergence. I don't think I understand exactly what is expected of me. convergence of E(M)? I'm lost please help!
Play with the following:
data prob1;
call streaminit (33);
do k = 2 to 12;
do rep = 1 to 8;
do i = 1 to 2**k;
sum = 0 ;
M = 0 ;
do until (sum > 1) ;
xuni = rand('uniform', 0, 1);
sum + xuni;
M + 1;
end ;
output;
end;
end;
end;
keep k rep M;
run;
proc summary data=prob1;
by k rep;
var M;
output out=prob2 mean=meanM;
run;
proc sgplot data=prob2;
scatter x=k y=meanM / jitter;
xaxis integer;
run;
THANK YOU!
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.