- data R;
- retain R Rwin RPW Rloss RPL;
- do i=1 to 100;
- if i=1 then do;
- m=100;
- R=1/100;
- Rwin=0.1;
- RPW=5;
- RPL=0;
- Ran=RANUNI(999);
- if Ran<=Rwin then win=m*R*(RPW+1);
- else win=-m*R;
- end;
- else do;
- m=m+win;
- Ran=RANUNI(999);
- if Ran<=Rwin then win=m*R*(RPW+1);
- else win=-m*R;
- end;
- output;
- end;
- run;
- Proc sgplot data=R;
- scatter x=i y=m;
- run;
- Proc sgplot data=R;
- scatter x=i y=win;
- run;