Hi,
I'm working within Proc IML and have already set up a maximum likelihood function and using nlpnrr method to optimise. The optimisation itself works well. The problem is when I added certain If-Then_else statements within this optimization procedure. I need to put condition on certain elements/observations in the matrices. For example,
if income[,m] < 0 then income[,m]=0; else income[,m]=income[,m];
The rows of the matrix are individuals and m is the number of ways that I calculate income in the previous lines through a do loop..
I noticed that when I put this condition, the way SAS reads it is - if income is negative for ALL the elements in each column then it'll give zeros to ALL the individuals in that column, otherwise it keeps income as it is for everyone. However, what I need to see is to only give 0 to those observations that have a negative income. When I add "i" in the above code so that;
do i=1 to num; /*num is number of observations*/
if income[i,m] < 0 then income[i,m]=0; else income[i,m]=income[i,m];
end;
this works but the problem is that this code doesn't work in optimisation procedure and I get error.
So my question is that how can I do this within the nlpnrr optimisation procedure? I appreciate any help..