Hello everyone, Thank you for your code especially Rob. I do not have proc optmodel in my SAS subscription, but I have SAS IML. I have tried to write the code in IML but failed miserably. I tried to read from SAS documentation and online topics and have written the following code. I would be very thankful if you guys can help me fix it. proc iml; x={0 -1.78 -2.68 -3.06 -3.4 -3.83 1885, 0 2.12 -2.15 -2.63 -2.94 -3.34 3151, 0 2.45 1.16 -1.39 -1.99 -2.54 246, 0 2.48 1.92 1.19 -1.13 -2.39 80, 0 2.68 2.32 1.82 1.52 -1.56 89} ; varNames= ("cat3" : "cat8" ||"num_rat"); rowNames= ("cat_3" : "cat_7"); n_x = nrow(x); p_x = ncol(x-1); print n_x p_x ; create mydata1 from x[colname=varNames rowname=rowNames]; append from x [rowname = rowNames]; close mydata1; start obj_z(p, phi, delta, rho, init_z); num_col=ncol(x-1); num_row=nrow(x); num_r=x[,7]; do i = 1 to num_row; p{i in num_rows, j in num_col} = CDF('Normal', x[i,j+1]) - CDF('NORMAL', x[i,j]); phi{i in num_rows, j in num_col} = CDF('Normal', (Cat_C[i,j]-sqrt(&rho)*Z)/sqrt(1-&rho)); delta {i in num_rows, j in num_col} = Phi[i,j+1] - Phi[i,j]; sum_z= (num_rat[i] * (P[i,j] - Delta[i,j])**2 / (Delta[i,j] * (1 - Delta[i,j]))); finish; call nlpqn(min(obj_z)) = "result"; print "result"; run;
... View more