month identifier

For questions regarding programming in the EViews programming language.

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

remuct
Posts: 37
Joined: Fri May 12, 2017 6:47 am

month identifier

Postby remuct » Fri May 12, 2017 7:22 am

Hi,
I am a Eviews9 user and I am trying to create a monthly series x(t) whose observations are the cumulative sum of the observations of another monthly series y(t) from the previous January to the current month. The cumulative sum is reinitialized every 12 months, ie every January.

Example: suppose the year is Y
x(Ym1)=y(Ym1)
x(Ym2)=y(Ym1)+y(Ym2)
x(Ym3)=y(Ym1)+y(Ym2)+y(Ym3)
etc...

What I need at least is a way to identify the January observations. Is there a way to do this?
Thanks for your help

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

Re: month identifier

Postby EViews Gareth » Fri May 12, 2017 7:32 am

Assuming your workfile starts on a January:

Code: Select all

series x = @recode(@month=1,y,y+x(-1))

remuct
Posts: 37
Joined: Fri May 12, 2017 6:47 am

Re: month identifier

Postby remuct » Fri May 12, 2017 7:49 am

Assuming your workfile starts on a January:

Code: Select all

series x = @recode(@month=1,y,y+x(-1))
Well, unfortunately the workfile contains several X series which do not necessarily start on January. I need to find a way to identify January observations among series starting on any month. But thank you anyway for your @recode suggestion, I'll see if I can handle with it...


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests