I have the following problem: I tried to write a procedure that defines a frml which I need for later use. (I want to use a procedure because I have to define a lot such frmls.) It defines a frml that is equal to a trending function over some period and defines a decay of the slope after that end of that period:
Code: Select all
procedure checkcoeffs frmlname1 frmlname2
type frml *frmlname1 *frmlname2
option integer start
option integer end
option integer row 1
option integer col 1
option ser[rec] ioc
option real decay .5
*
local series coeffts
*
set coeffts start end = ioc(t)(row,col)
*
linreg coeffts start end
# constant trend
frml(lastreg) frmlname2
frml frmlname1 = %if(t<=end,%max(.0,frmlname2(t)),%max(.0,frmlname1(t-1)+decay^(t-end)*(frmlname2(end)-frmlname2(end-1))))
end procedure checkcoeffs
Code: Select all
decl frml frml_51_01 frml_54_01
@checkcoeffs(graph,decay=decay,start=2003:1,end=2007:1,ioc=ioc,row=51,col=1) frml_51_01 temp_51_01
@checkcoeffs(graph,decay=decay,start=2003:1,end=2007:1,ioc=ioc,row=54,col=1) frml_54_01 temp_54_01
set test51 = frml_51_01(t)
set test54 = frml_54_01(t)
Is there any way I can produce "static" frmls by a procedure with parameter values that do not change if the procedure is used multiple times (with different names for the frml-output)?