Page 1 of 1

Accessing specific values from a series

Posted: Sat Jun 27, 2009 6:45 am
by Billaudes
Hi everyone,

I have a time series object called y3_0mp from which I want to access the the 397th, 400th, 403rd, and 406th value (and multiply them with each other). Afterwards reiterate the process with plus 1 values. This is what I have come up with so far:

for !j=0 to 206

series y12_eh_{!j}=(@elem(y3_0mp, @otod(397+{!j})))*(@elem(y3_0mp, @otod(400+{!j}))))*(@elem(y3_0mp, @otod(403+{!j})))*(@elem(y3_0mp, @otod(406+{!j})))


next

However it gives me the followin error message: "Illegal date 397+0". I also tried just the loop in there and it didn't work, any ideas???? I also tried to simply type in the date as it is and it didn't work.

Thanks,
Billaudes

Re: Accessing specific valies from a series

Posted: Sat Jun 27, 2009 8:07 am
by EViews Gareth
create string variables equal to the dates first, then use the string variables inside the @elem.

Re: Accessing specific values from a series

Posted: Sat Jun 27, 2009 10:00 am
by Billaudes
Hi,

thanks for your response, I am however having difficulties converting those dates to strings, this is what I have tried so far:

y3_0mp=@datestr(yyyy/mm)

other commands also kinda failed (strnow), I think I am declaring the format in a wrong way. my dates are monthly (e.g.1959M02), not sure how the correct format would look like.

Thanks for your help,
Billaudes

Re: Accessing specific values from a series

Posted: Sat Jun 27, 2009 10:50 am
by EViews Gareth
I meant do something like this:

Code: Select all

%date1 = @otod(397+!j) @elem(y3_0mp,%date1)

Re: Accessing specific values from a series

Posted: Sat Jun 27, 2009 11:02 am
by Billaudes
That is brilliant thank you sooo much, I have been sitting on this quite a while now!!