When posting an example, please use a seed value that is nonzero so that we can reproduce your results. In the following, I use
seed=10;
You can't perform a MLE on a single datum. You need a sample size greater than 1. I suspect you know this and just forgot to allocate an array for U. This should address your immediate problem:
Proc iml;
seed=10; theta= 1.5 ; beta= 1; m=50;
print theta beta m ;
**** MLE ***;
start MLE_func(y) global (m,X);
theta=y[1];
beta=y[2];
Log_X=log(1+x#beta);
func = m*log(theta*beta) - (theta+1) * Log_X[+] ;
Return(func);
finish;
call randseed(seed);
N = 100;
U = j(N, 1);
call randgen(U, "Uniform");
Call sort(U);
X =( (1-U)##(-1/theta) - 1 )/ beta;
************* Constrain MLE ***********************;
x0={1,1};
con={.001 .001, . . };
opt={2 0};
tc={10000 16000};
Call nlpqn(rc, MLE_ret, "MLE_func", x0, opt, con,tc);
Theta_hat = MLE_ret[1];
Beta_hat = MLE_ret[2];
print Theta_hat Beta_hat;