Extract forecasted values into excel spreadsheet

For questions regarding programming in the EViews programming language.

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

AntonioAcha
Posts: 21
Joined: Wed Jan 07, 2015 8:49 am

Extract forecasted values into excel spreadsheet

Postby AntonioAcha » Tue Dec 29, 2015 1:46 pm

Hello, I'm running a model with several equations in order to forecast some variables. As an input I'm using a big excel file, where Eviews read the values, in this manner:

wfcreate(wf=model, page=model) q 1996q01 2016q04
cd "\\xxxxx\xxx....."
read(B3) var1 var2 var3 var4 var5 ....var30

Then, I have several equations for these multiple varibles and I solve the model

eq1.ls y x1 x2 x3
eq2.ls z v x2 x3 c
eq3.ls r x1 k j

Finally I solve the model

model bigmodel
for %eq eq1 eq2 eq3
bigmodel.merge {%eq}
next

Everything working and solved without problem, mi question is about extracting the forecasted values of some series into the excel spreadsheet that I used as input, for example, the variable Y has historical data , which in the excel spreadsheet in the range B3:B115, therefore I want the forecast of this variable to be inserted into the excel spreadsheet starting in B116 , so each time I run the whole model and get new forecast for the variables I want the forecast tto be inserted in the excel spreadsheet.

Any help is appreciated

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

Re: Extract forecasted values into excel spreadsheet

Postby EViews Gareth » Tue Dec 29, 2015 2:04 pm

The wfsave command has a range argument that lets you specify which Excel range the data should be saved to, and a mode option for specifying whether the file should be replaced or merged into.

You probably want something like:

Code: Select all

wfsave(type=excelxml, mode=update) myfile.xlsx range="b116"
By the way, you should be using wfopen or import rather than wfcreate and read.

AntonioAcha
Posts: 21
Joined: Wed Jan 07, 2015 8:49 am

Re: Extract forecasted values into excel spreadsheet

Postby AntonioAcha » Wed Dec 30, 2015 10:50 am

Thanks for the reply Gareth. Could it be possible to make the extraction of forecasted values for a specific variable instead of the whole dataset?

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

Re: Extract forecasted values into excel spreadsheet

Postby EViews Gareth » Wed Dec 30, 2015 11:08 am

wfsave has an @keep argument.

AntonioAcha
Posts: 21
Joined: Wed Jan 07, 2015 8:49 am

Re: Extract forecasted values into excel spreadsheet

Postby AntonioAcha » Wed Jan 06, 2016 7:21 am

Hello Gareth, thanks for the previous reply. I still can't solve my doubt. The forecasted values in the solved model appear in the model as var1_0 (the forecasted value of var1). My problem is that I need this:
var1_0 -----> D82:D96 (excel cell, where forecasted values will start)
var2_0 -----> I82:I96
var3_0 -----> T82:T96
and so on

I do not want others columns to be alterated, because they have useful info comming from other sources. (What I mean is that for example A82:A96 , C82:C96 have relevant information that I need to keep unchanged after running the model). Using wfsave , may I specify that I need a certain variable (VAR1_0, VAR2_0, VAR3_0) to be inserted in a specific column and row (D82:D96, I82:I96,T82:T96)?

Any help is appreciated

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

Re: Extract forecasted values into excel spreadsheet

Postby EViews Gareth » Wed Jan 06, 2016 8:54 am

Yes, you can use the range= argument and the @keep argument.

AntonioAcha
Posts: 21
Joined: Wed Jan 07, 2015 8:49 am

Re: Extract forecasted values into excel spreadsheet

Postby AntonioAcha » Thu Jan 07, 2016 8:41 am

Not clear enough. I have this
Var1 Var1_0
2014q1 12 12
2014q2 11 11
2014q3 41 41
2014q4 36 36
2015q1 25 25
2015q2 56 56
2015q3 13 13
2015q4 10 10
2016q1 11
2016q2 18
2016q3 40
2016q4 32

I need to extract the values from 2016q1:2016q4 into the cells D81:D84

When I use:
range="D81:D84" @keep Var1_0

It give me the first four values of the series (12,11 , 41, 36) , but I need the four last( which correspond to the forecasted values)

So how do I specify in the command that the last four values goes into those cells I need

Thanks

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

Re: Extract forecasted values into excel spreadsheet

Postby EViews Gareth » Thu Jan 07, 2016 8:51 am

There is also an @smpl argument.

AntonioAcha
Posts: 21
Joined: Wed Jan 07, 2015 8:49 am

Re: Extract forecasted values into excel spreadsheet

Postby AntonioAcha » Thu Jan 07, 2016 10:34 am

Solved, thanks.


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests