%let p0=0.05;
%let p1=0.25;
%let alpha=0.1;
%let beta=0.1;
%let usern=15;
****Stage 1;
data stage1;
do n1=5 to &usern-1;/*The totals ACCEPTABLE size is set sas "usern", n1 is the total size to be studied at stage 1*/
do r1=0;
term1_p0 = cdf('BINOMIAL', r1, &p0, n1);/*PET: probability of terminate after stage 1 when the drug is ineffective;This is also the Type I ERROR at stage 1*/
term1_p1 = cdf('BINOMIAL', r1, &p1, n1);/*Probability of early ternation after stage 1 when, in fact, the drug is effective;*/
if term1_p1=<&beta then output; /*remove solution sets that do not meet the beta requirement; This is the type II ERROR occurred at stage 1*/
end;
end;
run;
*****Stage 2;
data stage12;
set stage1;
do n2=n1+1 to &usern-1;
do r2=r1+1 to n2 while (r1<r2<n2);
**term2_p0=0; *****initialize the summation terms for alpha & beta calculations;
**term2_p1=0;
do x1=r1+1 to min(r2, n1);/*x1: stand for the possible number of responses at stage 2 ONLY*/
**dum0=pdf('BINOMIAL', x1, &p0, n1)*cdf('BINOMIAL', r2-x1, &p0, n2-n1);
**dum1=pdf('BINOMIAL', x1, &p1, n1)*cdf('BINOMIAL', r2-x1, &p1, n2-n1);
**term2_p0= term2_p0+dum0;*recursive formulae used for summation terms;
**term2_p1= term2_p1+dum1;
output;
end;
output;/*Remove the conditions "1-(term1_p0+term2_p0)=<&alpha and" */
end;
end;
run;
Regard to the above code, how could the value of X1 be greater than r2 as shown in below shot?