In reply to Dale McLerran.

Thanks for writing and for including the code for the MLE estimates. I like the trick of using the parameters on the log scale. Readers who want to learn more about how to use PROC NLMIXED for MLE can refer to the article "Two ways to compute maximum likelihood estimates in SAS."

Since you mentioned regression, I will mention that PROC FMM can support beta-binomial regression. It uses a different parameterization and does not directly estimate a and b, but only the mean value a/(a+b), which is often the quantity of interest. It also requires that the data be in events/trials syntax. If you keep the nTrials variable in the simulated data, you can run the following:

proc fmm data=BetaBin;
model x/Ntrials = / dist=betabinomial;
output out=out predicted;
run;

data _null_;
set out(obs=1);
a = 6.8352;
b = 4.5073 ;
mu = a/(a+b);
diff = Pred - mu;
put Pred= mu= Diff=;
run;