I am trying to automate building a state space to avoid having numerous lines of code.
I want to estimate a relationship for a variable in levels or divided by GDP. I thus have created variables in level and divided by GDP. The structure of the names of the variables is convenient and allows easily selecting one or the other.
However, I do not manage to pass the names to the state space.
I paste below a mock example. I know that this model makes no sense, it is simply there to show what does not work.
Code: Select all
wfcreate(wf=annual, page=myproject) a 1950 2005
genr series1=nrnd
genr series2= 0.9*series1(-1)+ 0.1*nrnd
%stdgdp="gdp" ' shortcut for standarization by GDP: "" for not, "gdp" if yes
svector(2) longnames
longnames(1) = "series1" +%stdgdp ' append the shortcut for whether it is standardized by GDP or not
longnames(2) = "series2" +%stdgdp
%varnames1=longnames(1)
%varnames2=longnames(2)
for !i=1 to 2 ' loop over the variables to create the GDP series
%stringtemp2=longnames(!i) 'create temporary variable for the long
series {%stringtemp2}gdp= {%stringtemp2}+!i*1000
next
' Not working state space
statespace locallevelbis ' Create the state space
locallevelbis.append @signal {%varnames1}=mu +[ename = e1, var = exp(c(1))]
locallevelbis.append @state mu=mu(-1) +[ename = e2, var = exp(c(2))]
locallevelbis.ml
longnames(1)
!longnames(1)
%longnames(1)
{longnames(1)}
{!longnames(1)}
{%longnames(1)}
and the same with varnames1, without success.
When using { }, I get the following error message:
, which leads me to believe that the temporary variable varnames1 is empty. I confirm this by running the command:Syntax error in "@SIGNAL =MU +[ENAME = E1, VAR =
EXP(C(1))]" in "LOCALLEVELBIS.ML" on line 75.
Code: Select all
statusline {%varnames1}
Thanks a lot in advance.