On Fri, 4 Sep 2020, Fred Morkel wrote:
If I adopt my problem to your example, I would need something like:
ols y_FOO const log(x_FOO)
ols y_BAR x_FOO/x_BAR
ols y_BAZ x_BAZ x_BAR x_FOO
If I'm not mistaken, I can't introduce a loop or use a function here.
Something like this should do it:
<hansl>
function void do_regressions (list LY, list LX)
loop foreach i LY
if i == 1
series lx = log(LX[1])
ols $i const lx
elif i == 2
series x_x = LX[1] / LX[2]
ols $i x_x
else
ols $i LX
endif
endloop
end function
list LY = y_FOO y_BAR y_BAZ
list LX = x_FOO x_BAR x_BAZ
do_regressions(LY, LX)
</hansl>
Allin