how to store a single value from a series into a matrix?

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Jason, EViews Moderator, EViews Matt

Yohan
Posts: 17
Joined: Sun Aug 26, 2012 5:08 pm

how to store a single value from a series into a matrix?

Postby Yohan » Mon Jun 05, 2017 6:49 pm

Hello altogether,

here is a excerpt of my code (from a state space model), which is inside a loop:

smpl 9/22/2014+!forecasthorizon+!h-1 9/22/2014+!forecasthorizon+!h-1
' sets the forecast horizon

{%modelname}{!forecasthorizon}.forecast(m=n,n=!forecasthorizon) @state * @signal {%modelname}{!forecasthorizon}_lcdsprognose_d @signalse {%modelname}{!forecasthorizon}_lcdsprognosese_d
' generates the forecasts

scalar dummyeins = @elem({%modelname}{!forecasthorizon}_lcdsprognose_d,"9/22/2014+!forecasthorizon+!h-1")
scalar dummyzwei = @elem({%modelname}{!forecasthorizon}_lcdsprognosese_d,"9/22/2014+!forecasthorizon+!h-1")

matrix prognose(!h,1) = dummyeins
matrix prognosese(!h,1) = dummyzwei

series {%modelname}{!forecasthorizon}_lcdsprognose
series {%modelname}{!forecasthorizon}_lcdsprognosese

mtos(prognose,{%modelname}{!forecasthorizon}_lcdsprognose)
mtos(prognosese,{%modelname}{!forecasthorizon}_lcdsprognosese


This code should generate a forecast window from a recursive estimation scheme. The forecasting values for the signals and signal se's should be stored in the matrices prognose and prognosese, where !h goes forward one step in the forecast window.

My problem:
i get (not surprisingly!) the message, that "9/22/2014+!forecasthorizon+!h-1" in the program rows "scalar dummyeins" and "scalar dummyzwei" is a illegal date. How can i extract the desired element of the signal series and subsequently transform it into a scalar?


Thank you very much!
Kind regards, Yohan

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13318
Joined: Tue Sep 16, 2008 5:38 pm

Re: how to store a single value from a series into a matrix?

Postby EViews Gareth » Mon Jun 05, 2017 8:23 pm

Code: Select all

%date = @datestr(@dateval(9/22/2014)+!forecasthorizon+!h-1, "YYYY/MM/DD")
scalar dummyeins = @elem({%modelname}{!forecasthorizon}_lcdsprognose_d,%date)
Follow us on Twitter @IHSEViews


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 32 guests