I'm struggling to take some SAS code and 'translate' it into stata and am hoping someone can help. I suspect its a lack of understanding what stata is doing but any thoughts appreciated. The part of the SAS code I am trying to implement in STATA is:
do while (p>0.5);
ka=ka-1;
p=cdf('binomial',ka,prop,n);
end;
Which I thought in stata was:
while (p>0.5){
replace ka=(ka-1)
replace p=binomial(n,ka,prop)
}
However, I get completely different answers, so obviously the way stata deals with the loop is different to sas. Oh, and I know the SAS code is giving the correct answers.
Can post more code if it would be helpful but didnt want to bombard the post with lots of code.
do while (p>0.5);
ka=ka-1;
p=cdf('binomial',ka,prop,n);
end;
Which I thought in stata was:
while (p>0.5){
replace ka=(ka-1)
replace p=binomial(n,ka,prop)
}
However, I get completely different answers, so obviously the way stata deals with the loop is different to sas. Oh, and I know the SAS code is giving the correct answers.
Can post more code if it would be helpful but didnt want to bombard the post with lots of code.