Last Data Point of the Year

For questions regarding programming in the EViews programming language.

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

w_nawfal
Posts: 69
Joined: Fri Jul 30, 2010 6:58 am
Location: Montreal, Canada
Contact:

Last Data Point of the Year

Postby w_nawfal » Mon Oct 25, 2010 3:51 pm

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

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

Re: Last Data Point of the Year

Postby EViews Gareth » Mon Oct 25, 2010 4:29 pm

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)?

w_nawfal
Posts: 69
Joined: Fri Jul 30, 2010 6:58 am
Location: Montreal, Canada
Contact:

Re: Last Data Point of the Year

Postby w_nawfal » Tue Oct 26, 2010 5:15 am

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


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests