Page 1 of 1

Last Data Point of the Year

Posted: Mon Oct 25, 2010 3:51 pm
by w_nawfal
Hello All.

I'm trying to create a simple year-to-date (ytd) % change calculation i.e. genr seriesXytd = seriesX/seriesX(-ytd)

how can I reliably obtain a value for the "ytd" variable?

i've tried creating a scalar value a al

smpl 31/12/2009 25/10/2010
fetch(d=database) seriesX
scalar ytd = @obs(seriesX)

but unfortunately because i use many series (whose last data point may or may not be today's date) one scalar value use for all ytd calculations is incorrect

Many thanks in advance for any help

Wes

Re: Last Data Point of the Year

Posted: Mon Oct 25, 2010 4:29 pm
by EViews Gareth
I'm not sure I follow what this ytd value you're trying to capture is.

The number of observations a particular series has in this calendar year?

The number of days since January 1st 2010?

The total number of observations a particular series has (which is what you seem to be indicating by the @obs function)?

Re: Last Data Point of the Year

Posted: Tue Oct 26, 2010 5:15 am
by w_nawfal
Hi Gareth & thanks for the reply.

the ytd value is the % change in a series since the begining of the year - thus i need to divide the latest value of a series by last value in the preceeding calandar year (today's oct 26th for example, so i would take the value today / by the value on Dec 31,2009

I was using the @obs function, but that lead to some problems due to some indiscrepencies with the data i'm using - however I may have a solution using the @elem function to specify the dates i want for each series...

thanks for the tip.

Wes