Hi all,

I need to write a loop to solve the equations below.

```
utility(ii,t)$(ord(t) le card(a)-1).. u=e=(1/(1-1/gamma))*sum(a,ss(a)*((1+beta(ii))**(1-ord(a)))*(1-1/gamma)*log((c(ii,a,t)**(1-1/rho)+alpha*l(ii,a,t)**(1-1/rho))**(1/(1-1/rho))));
asset(ii,a,t).. as(ii,a,t)=e=(1+r)*as(ii,a-1,t-1)+w(t)*e(ii,a)*(1-l(ii,a,t))+AP(ii,a,t)+NSB(ii,a,t)+SP(ii,a,t)-Tax(ii,a,t)-(1+tau_c)*c(ii,a,t);
income_test(ii,a,t).. API(ii,a,t)=e=max{min{p,p-theta*(inc(iii,a,t)-IT)},0}$(ord(a) ge 45);
solve model /all/;
solve model using dnlp maximizing u;
```

I am able to loop ii by creating a dynamic set

```
iii(ii) /1*3/ *dynamic set for ii,
iii(ii)=no;
loop(ii,
iii(ii)=yes;
*solve statement
);
```

However, as set t and a have orders and lags I am getting errors if I try to write a dynamic set and to turn it off by tt(t)=no;

I need to solve the model by

```
loop(t,
loop(ii,
);
);
```

Thanks for all the support you can give me.

Fabio