a simple programme

For questions regarding programming in the EViews programming language.

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

suchen
Posts: 13
Joined: Thu Aug 01, 2013 10:59 am

a simple programme

Postby suchen » Fri Mar 10, 2017 8:16 am

I have 100 series

y1 y2 y3 .... y100

and i need to produce a new series y = average of (y1 + y2 + y3 +... + y100),

Could you please help write a syntax, many thanks.

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

Re: a simple programme

Postby EViews Gareth » Fri Mar 10, 2017 8:27 am

You'll have to be more specific.

suchen
Posts: 13
Joined: Thu Aug 01, 2013 10:59 am

Re: a simple programme

Postby suchen » Fri Mar 10, 2017 8:34 am

Thanks for your reply:

I have 100 series y1, y2, y3, y4, ..., y99, y100

and now i need to create a new series y, which is the average of the 100 series,

y = (y1 +y2 +y3+... + y100)/100

i am wondering if there is a simple syntax for this, thanks.

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

Re: a simple programme

Postby EViews Gareth » Fri Mar 10, 2017 8:35 am

Y1 is a single number?

suchen
Posts: 13
Joined: Thu Aug 01, 2013 10:59 am

Re: a simple programme

Postby suchen » Fri Mar 10, 2017 8:43 am

y1, y2, y3, ... y100, each of them is a series with 50 obs.

i want to get a new series y with 50 obs, each ob. is the average of the (y1, y2, y3, ... y100)

of course we can write y = (y1 +y2 + y3 +... +y100)/100,

but this is too complicated, is there any way like y1:y100 in excel?

hope this is clear, thanks.

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

Re: a simple programme

Postby EViews Gareth » Fri Mar 10, 2017 9:10 am

ok, I think you're saying you want the observation by observation average.

Put the series into a group, then use the @rmean function.

suchen
Posts: 13
Joined: Thu Aug 01, 2013 10:59 am

Re: a simple programme

Postby suchen » Fri Mar 10, 2017 9:20 am

thanks, group is good

group y y1, y2, y3, ..., y100

i just feel it is too complicated to write from y 1 to y100, is there an easy way to do this? like y1:y100?

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

Re: a simple programme

Postby EViews Gareth » Fri Mar 10, 2017 9:33 am

group y y*

suchen
Posts: 13
Joined: Thu Aug 01, 2013 10:59 am

Re: a simple programme

Postby suchen » Fri Mar 10, 2017 9:44 am

group y y*

this group y1 to y100,

can i ask another question, if i have y1 to y100 series, but i just want to group y1 to y99, is there any parameter setting?

sorry for the silly question:(

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

Re: a simple programme

Postby EViews Gareth » Fri Mar 10, 2017 9:51 am

Easiest thing is to do:

Code: Select all

group y y* y.drop y100

suchen
Posts: 13
Joined: Thu Aug 01, 2013 10:59 am

Re: a simple programme

Postby suchen » Fri Mar 10, 2017 9:58 am

group y y*
y.drop y100

many thanks for your patience, this works very well,

but i still want to know if we can make a parameter setting,

for example, i have the y1 to y100 series, but i just wanna group (y1 to y50), what should i do? many thanks.

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

Re: a simple programme

Postby EViews Gareth » Fri Mar 10, 2017 10:08 am

Code: Select all

group y for !i=1 to 50 y.add y{!i} next

suchen
Posts: 13
Joined: Thu Aug 01, 2013 10:59 am

Re: a simple programme

Postby suchen » Fri Mar 10, 2017 10:20 am

many thanks, it looks fine, i will try.
thanks for your patience. have a good weekend.


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests