What I want to do: determine the empirical values for alpha and beta from a simulated sample from a gamma(alpha,beta) distribution.

Say it looks something like this:

proc iml;

alpha=10;

beta=5;

sumofvaluepower1 = 0;

sumofvaluepower2 = 0;

do q = 1 to 20;

gammavalue = rangam(1,alpha)*beta;

sumofvaluepower1 = sumofvaluepower1 + gammavalue;

sumofvaluepower2 = sumofvaluepower2 + gammavalue**2;

end;

empexpectedvalue = sumofvaluepower1 / 20;

empvariance = (sumofvaluepower2 / 20) - empexpectedvalue**2;

/*here i need a way, to calculate from the expected value of the sample, and the variance, the empirical values for alpha and beta (which should be close to my original, fixed alpha and beta). intuitively I feel that this should not be a difficult feat but I am being stupid in not being able to figure this out!*/

quit;

Anyone any advice?