Hello,
I would like to put the year and the value of the series correspondingto that year in a table as below. But I keep getting an error. And this is in a loop, so I need to increase it. Could you think of a way to program this?
Thanks a lot
Alps
setcell(for_aus,!j+1, 1,1998Q1+!j)
setcell(for_aus,!j+1, 2,@elem(dlindex,1998Q1+!j))
trouble with years in a setcell
Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13604
- Joined: Tue Sep 16, 2008 5:38 pm
Re: trouble with years in a setcell
I think I'd just freeze the sheet view of the series:
Code: Select all
freeze(for_aus) dlindex.sheet
Re: trouble with years in a setcell
Thanks but I want to add other numbers on this table, so I don't think freeze would work. I copied my program below. Thanks a lot for your help
for !j=1 to end-1
'regular model
smpl 1983Q2+!j-1 1998Q1+!j-1
equation eq_cu_!j.ls(n) dlindex = c(1) + c(2) * dlusd_1 + c(3) * dlindex_1
smpl 1998Q1+!j 1998Q1+!j
forecast eq_cu_f!j
'AR model
smpl 1983Q2+!j-1 1998Q1+!j-1
equation eqAR_cu_!j.ls(n) dlindex = c(1) + c(3) * dlindex_1
smpl 1998Q1+!j 1998Q1+!j
forecast eqAR_cu_f!j
'Random Walk
smpl 1983Q2+!j-1 1998Q1+!j-1
equation eqRW_cu_!j.ls(n) dlindex = c(1) + c(2) * dlusd_1
smpl 1998Q1+!j 1998Q1+!j
forecast eqRW_cu_f!j
setcell(for_aus,1, 2,"lindex")
setcell(for_aus,1, 3,"Model")
setcell(for_aus,1, 4,"AR")
setcell(for_aus,1, 5,"Random Walk")
scalar xx=@elem(dlindex,1998Q1+!j)
setcell(for_aus,!j+1, 1,1998Q1+!j)
setcell(for_aus,!j+1, 2,@elem(dlindex,1998Q1+!j))
'setcell(for_aus,!j+1, 3,@elem(eq_cu_f!j, 1998Q1+!j))
'setcell(for_aus,!j+1, 4,@elem(eqAR_cu_f!j,1998Q1+!j))
'setcell(for_aus,!j+1, 5,@elem(eqRW_cu_f!j,1998Q1+!j))
next
for !j=1 to end-1
'regular model
smpl 1983Q2+!j-1 1998Q1+!j-1
equation eq_cu_!j.ls(n) dlindex = c(1) + c(2) * dlusd_1 + c(3) * dlindex_1
smpl 1998Q1+!j 1998Q1+!j
forecast eq_cu_f!j
'AR model
smpl 1983Q2+!j-1 1998Q1+!j-1
equation eqAR_cu_!j.ls(n) dlindex = c(1) + c(3) * dlindex_1
smpl 1998Q1+!j 1998Q1+!j
forecast eqAR_cu_f!j
'Random Walk
smpl 1983Q2+!j-1 1998Q1+!j-1
equation eqRW_cu_!j.ls(n) dlindex = c(1) + c(2) * dlusd_1
smpl 1998Q1+!j 1998Q1+!j
forecast eqRW_cu_f!j
setcell(for_aus,1, 2,"lindex")
setcell(for_aus,1, 3,"Model")
setcell(for_aus,1, 4,"AR")
setcell(for_aus,1, 5,"Random Walk")
scalar xx=@elem(dlindex,1998Q1+!j)
setcell(for_aus,!j+1, 1,1998Q1+!j)
setcell(for_aus,!j+1, 2,@elem(dlindex,1998Q1+!j))
'setcell(for_aus,!j+1, 3,@elem(eq_cu_f!j, 1998Q1+!j))
'setcell(for_aus,!j+1, 4,@elem(eqAR_cu_f!j,1998Q1+!j))
'setcell(for_aus,!j+1, 5,@elem(eqRW_cu_f!j,1998Q1+!j))
next
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13604
- Joined: Tue Sep 16, 2008 5:38 pm
Re: trouble with years in a setcell
I wouldn't bother using setcell then, just stick things in the table directly:
Also, you probably can't use @elem directly, and you can't calculate dates directly. You'll have to put them into strings first.
Code: Select all
table(1,3) = "hello"
Re: trouble with years in a setcell
thanks, maybe my question is how to put the dates (or year) to put in a table. Eventually I want to create a table like this
Dleindex RW AR
1998Q1 0.222 0.92 0.322
1998Q2
1998Q3
1998Q4
The issue is to put the date in the table, I cannot that figure it out because 199Q1+!j doesn't work.
Thanks again
Alps
Dleindex RW AR
1998Q1 0.222 0.92 0.322
1998Q2
1998Q3
1998Q4
The issue is to put the date in the table, I cannot that figure it out because 199Q1+!j doesn't work.
Thanks again
Alps
Re: trouble with years in a setcell
I get an error message on this command 1998Q1+!j doesn't work.
scalar xx=@elem(dlindex,1998Q1+!j)
Can you think a solution?
scalar xx=@elem(dlindex,1998Q1+!j)
Can you think a solution?
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13604
- Joined: Tue Sep 16, 2008 5:38 pm
Re: trouble with years in a setcell
1998q1+!j makes no sense to EViews. You'll have to use some of the date functions to actually calculate the date you want. Probably something involving a mixture of @dateadd and @dateval and @datestr.
I'll maintain that you're probably best off just using the frozen view of the series though, then adding to that table.
I'll maintain that you're probably best off just using the frozen view of the series though, then adding to that table.
Re: trouble with years in a setcell
Thanks. yes the statement I put in my previous posting doesn't work, what I want to do is to add the year and the value of more than one series in a table in a loop.
Probably what I was trying to do was not the best apporach.
I am forecasting for a quarter for 3 different equations and I want to store each forecasted value and the corresponding year-quarter in a table.
how can I do that with the freeze command you mentioned.
Thanks a lot
Alps
Probably what I was trying to do was not the best apporach.
I am forecasting for a quarter for 3 different equations and I want to store each forecasted value and the corresponding year-quarter in a table.
how can I do that with the freeze command you mentioned.
Thanks a lot
Alps
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13604
- Joined: Tue Sep 16, 2008 5:38 pm
Re: trouble with years in a setcell
Why not put the three forecasted series into a group, then freeze the sheet view of the group?
Re: trouble with years in a setcell
yes, great idea. thanks a lot.
Who is online
Users browsing this forum: No registered users and 1 guest
