Hi,
I'm wondering if it is possible to include a loop inside a model. My model consists of single equations for GDP, inflation, the Fed funds rate, and the long-term interest rate. Here is the tricky part: the long-term interest rate in each quarter is a weighted sum of the short-term rate over the following 40 quarters. To calculate the long-term rate, I use the following loop:
genr z = 0
for !x = 0 to 39
genr zz = rtb(!x)*(0.98^!x)*(1 - 0.98)/(1 - 0.98^40)
genr z = z + zz
next
where (0.98^!x)*(1 - 0.98)/(1 - 0.98^40) are the weights. (I posted a question in the data manipulation section asking if there was a summation command that would do this so that I could avoid using a loop, but the answer is no.) The long-rate is an explanatory variable in the GDP equation, so it cannot simply be calculated after the model has solved.
Thanks for your help,
Matt
