how to program it?

For questions regarding programming in the EViews programming language.

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

tony
Posts: 59
Joined: Wed Jan 07, 2009 7:59 am

how to program it?

Postby tony » Tue Aug 10, 2010 6:37 am

how to program it?
y has 20 observations y(1),y(2),y(3),y(4),......y(20) ,I want to extract the first 2 observations and get the maximum denoted x(2),then compute z(2)=x(2)-y(3),loop this ,first 3 observations,the maximum x(3),z(3)=x(3)-y(4),......first 19 obs,x(19),z(19)=x(19)-y(20)
and finally z(2) z(3)......z(19)form a new series z.

trubador
Did you use forum search?
Posts: 1520
Joined: Thu Nov 20, 2008 12:04 pm

Re: how to program it?

Postby trubador » Tue Aug 10, 2010 11:58 pm

As far as I understand, you are looking for something like this:

Code: Select all

series z series x = @cummax(y) for !i=2 to 19 z(!i) = x(!i) - y(!i+1) next

tony
Posts: 59
Joined: Wed Jan 07, 2009 7:59 am

Re: how to program it?

Postby tony » Wed Aug 11, 2010 2:44 am

yeah,it works.Thank you!


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests