My excel example is a simple panel data. p,m,r,a1,a2 is from raw data: p is the group variable and m is the time period. when m=1, derived=1+(r+d)/3 else derived =derived[t-1]*(1+(r+d)/3) After derived is calculated, (a1-a2)/derived are sum for each group p, then the sum is average across all the groups. The objective of this problem is to find out d so that the final average value equal to target value. I wrote the following code but it seems optmodel does not allow the derived variable here. It didn't do anything and give out the message " NOTE: The problem has 0 variables (0 free, 0 fixed). NOTE: The problem has 0 linear constraints (0 LE, 0 EQ, 0 GE, 0 range). NOTE: The problem has 0 nonlinear constraints (0 LE, 0 EQ, 0 GE, 0 range). NOTE: An optimal solution already exists for the problem received by solver. " proc optmodel PRESOLVER=NONE; set I; number ID{I}; number r{I}, a1{I}, a2{I}; number der{I}, der1{I},value; read data testdata into I = [_n_] ID = _n_ r = r a1 = a1 a2 = a2; var d >=-1000 <=1000; for {j in I} do; if m =0 then der =1+(r +d)/3; else der =der[j-1]*(1+(r +d)/3); der1 =(a1 -a2 )/der ; end; value=sum{k in I} der1 ; min g=abs((value/2)-60); solve with NLPC OBJ g; quit;
... View more