Refer to group members...

For questions regarding programming in the EViews programming language.

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

lomfy
Posts: 36
Joined: Mon Jul 18, 2011 11:51 pm

Refer to group members...

Postby lomfy » Wed Jul 27, 2011 12:23 pm

Hi fellows,

this is a rather weird question I guess as I suppose there is an easy answer, but I simply can't think of it:

I have a database with many time series numbered from 1 to 96 (see attached workfile for an example of it including series 10 to 30 - don't be surprised,
the first 108 rows are NA, but rows 109 to 24 are not).

I need to categorize these series into two different groups, depending on whether the event was positive or negative - I do this by marking the respective series manually and save them as a group.

My question is:
How can i refer to the group members without having to mention their complete name?! (which would make the group categorization obsolete...)

For example, I need to do calculations with all of the members of the "positive" group.
However, I cannot use a "for !i=1 to..."-statement, as the groups member names are irregularly spaced, e.g.

Positive Group
ar10 ar14 ar15 ar16 ar18 ar20 ....

Negative Group
ar11 ar12 ar13 ar17 ar19 ar21 ....

For example, if I wish to access/refer to the members of the positive group ar10 ar14 ar15 ar16 ar18 ar20 .... (e.g. in order to calculate their stdev one by one and get the arithmetic mean of it or something alike), how could I do that without having to type their (irregularly spaced) names?

Is there a way to access them (for example by a group index number which I could access with a "for !i=1 to..."-statement, if there is something like that) or can I only solve the problem by re-entering the data in an ordered fashion (having positive events numbered ar1-ar45 and negative ar46-ar96)?

Your help is much appreciated!

lomfy
Posts: 36
Joined: Mon Jul 18, 2011 11:51 pm

Re: Refer to group members...

Postby lomfy » Wed Jul 27, 2011 12:26 pm

attachment...
Attachments
example.wf1
(55.08 KiB) Downloaded 308 times

EViews Glenn
EViews Developer
Posts: 2682
Joined: Wed Oct 15, 2008 9:17 am

Re: Refer to group members...

Postby EViews Glenn » Wed Jul 27, 2011 2:30 pm

Depending on what you want to do, this may or may not be the easiest way. You can just use the @seriesname() function to grab the name and you should be good to go.

Code: Select all

for !i=1 to argruppe_mm_neg.@count %name = argruppe_mm_neg.@seriesname(!i) {%name}.stats next

lomfy
Posts: 36
Joined: Mon Jul 18, 2011 11:51 pm

Re: Refer to group members...

Postby lomfy » Thu Jul 28, 2011 12:26 am

hey glenn,

thanks a lot for this proposal - I guess it would be the best one can do about it ...however i'll have to think about whether using your solution or simpy reloading the database will be easier, as the calulations i'll do with the group members won't be too easy...

nevertheless thank you very much for showing this possibility!!

EViews Glenn
EViews Developer
Posts: 2682
Joined: Wed Oct 15, 2008 9:17 am

Re: Refer to group members...

Postby EViews Glenn » Thu Jul 28, 2011 9:20 am

Don't forget that once you have the series you can use a subroutine or perhaps an add-in to hide all of the messy stuff that you are doing...


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 1 guest