Page 1 of 1
trouble with years in a setcell
Posted: Fri Mar 01, 2013 2:17 pm
by alps
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))
Re: trouble with years in a setcell
Posted: Fri Mar 01, 2013 2:48 pm
by EViews Gareth
I think I'd just freeze the sheet view of the series:
Re: trouble with years in a setcell
Posted: Fri Mar 01, 2013 3:09 pm
by alps
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
Re: trouble with years in a setcell
Posted: Fri Mar 01, 2013 3:30 pm
by EViews Gareth
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.
Re: trouble with years in a setcell
Posted: Fri Mar 01, 2013 3:41 pm
by alps
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
Re: trouble with years in a setcell
Posted: Fri Mar 01, 2013 3:51 pm
by alps
I get an error message on this command 1998Q1+!j doesn't work.
scalar xx=@elem(dlindex,1998Q1+!j)
Can you think a solution?
Re: trouble with years in a setcell
Posted: Fri Mar 01, 2013 5:04 pm
by EViews Gareth
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.
Re: trouble with years in a setcell
Posted: Sat Mar 02, 2013 12:03 am
by alps
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
Re: trouble with years in a setcell
Posted: Sat Mar 02, 2013 3:44 am
by EViews Gareth
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
Posted: Sat Mar 02, 2013 4:03 am
by alps
yes, great idea. thanks a lot.