Page 1 of 2

Getting the Names of the series in my group

Posted: Sat Apr 20, 2013 2:27 am
by telaxin
I have a group say G1 and I want to get the names of times series in my group. Is there any function that allows you to do that? Thanks!

e.g.

group g1 apple pear banana

I want to get the word apple pear and banana out.

Re: Getting the Names of the series in my group

Posted: Sat Apr 20, 2013 7:57 am
by EViews Gareth
Group.@members

Or

Group.@seriesname(1)

Re: Getting the Names of the series in my group

Posted: Sun Jan 12, 2014 6:12 pm
by pekaype01
Is it also possible to rename the seriesnames within a group without affecting the original series? Simply renaming it results in only the original seriesname to remain in the group but the values turning into NA.

Alternatively is it possible to access members of a group by recognizing word stems of the seriesnames within that group (wildcards)
ie: if I had a group with series containing 2 series called: a_??_stem b_??_stem, would it be possible to extract these *_stem variables only, through the command @member or @seriesname(1)?

Re: Getting the Names of the series in my group

Posted: Sun Jan 12, 2014 7:00 pm
by EViews Gareth
A group is simply a list of series names. It contains no data of its own. Thus you cannot rename a series within a group without renaming the underlying series, since they are the same thing.

I don't understand your second question.

Re: Getting the Names of the series in my group

Posted: Sun Jan 12, 2014 8:24 pm
by pekaype01
A group is simply a list of series names. It contains no data of its own. Thus you cannot rename a series within a group without renaming the underlying series, since they are the same thing.

I don't understand your second question.
THank you for your reply!

ad Question 1:

Ok. in that case, is it to rename series names and retaining them in the groups they were assigned to without loosing their data (currently when series are renamed only the original seriesnames are retained and all the data within that group is lost.

ad Question 2:

let me paraphrase, in one of your replies to a different question this is loop you wrote which partly answers my question:

Assuming that every series has a name, in the returns group, of RETURNSXXXXXX where XXXXXXX refers to the company code, and that same company code is used in the ebitda group with a similar pattern, then you just need something like:

for !i=1 to returns.@count
%code = @right(returns.@seriesname(!i), 6) 'grab the last 6 digits of the series name. This should be the company code
%namereturn = "returns" + %code
%nameebitda = "ebitda_mn_a" + %code
equation eq{%code}.ls {%nameebitda} c {%namereturn}
next


now Imagine in my case I have:
1) one group containing seriesnames with the structure d_??_XXX (where d is constant; ?? for two prefixes defining e.g. the state where a brand is sold; and XXX being the brand)
2) second group containing seriesnames with the structure a_US_XXX (where b is constant; US being US data being constant and XXX are the brands again)

Note that these brand names always have different name lenghts so only the first 5 signs of the name have identical structure
I now need to match the same brand xxx from group one to the same brand xxx in group 2.
In the above example you elegantly did this by writing a loop and defining a string %code which grabs the last digits of the seriesname. This loop does exaclty what I need, problem for me is that I need to define a string that extracts XXX which is of different lenghts, but since I know that the string will be all but the first 5 digits of the name ie something like
%code = @right (returns.@seriesname (!i), 1-6 'grab all but the first 5 digits of the seriesname as a string

Does something like this exist?

Thank you!

Re: Getting the Names of the series in my group

Posted: Sun Jan 12, 2014 8:28 pm
by EViews Gareth
You can't rename a series and keep it in a group, no.

You probably want the @mid function rather than @right

Re: Getting the Names of the series in my group

Posted: Wed Feb 05, 2014 12:41 pm
by pekaype01
Thank you so much Gareth that did the trick!!!works like a charm.

Based on this logic I have continued the following way, data structure same as before e.g. D_CA_XXX_*
I now have a group named "errorgroup_sa_d" which exctracted certain seriesnames by writing another loop which worked fine. From this group I now want to extract all those series defined as *XXX* in the middle of the seriesname contained in this group. This is what I wrote:


group group_CA_SA_XXX
for !i = 1 to errorgroup_sa_d.@count

%model = @mid(errorgroup_sa_d.@seriesname(i), 9)
%sedan = "D_CA" + "_XXX" + %model
group_CA_SA_XXX.add {%sedan}

Next

What am I doing wrong here? Error message : Group_CA_SA_XXX is not defined in "do_group_CA_SA_SDN.add D_CA_SDN"""

It appears to miss the string named %model in the loop. Please help

Re: Getting the Names of the series in my group

Posted: Wed Feb 05, 2014 12:47 pm
by EViews Gareth
Can't see anything wrong. Could you post your workfile?

Re: Getting the Names of the series in my group

Posted: Wed Feb 05, 2014 12:53 pm
by pekaype01
one second..the workfile is too large to be uploaded. I will resize it

Re: Getting the Names of the series in my group

Posted: Wed Feb 05, 2014 1:03 pm
by pekaype01
Sorry took me a while.

Here is the code that I am Using again:


for !i = 1 to errorgroup_sa_d.@count

%model = @mid(errorgroup_sa_d.@seriesname(i), 8)
%sedan= "D_CA_SDN" + "%model"
group_CA_SA_sdn.add {%sedan}

Next


Error message:

group_CA_SA_SDN is not defined in "do_group_CA_SA_SDN.add D_CA_SDN"""

its basically missing the %model string

Re: Getting the Names of the series in my group

Posted: Wed Feb 05, 2014 1:04 pm
by pekaype01
sorry instead of the smilie it should be "9)"

and the last line should be group_CA_SA_sedan.add.....
that was just a type not affecting the failure message

Thank you so much

Re: Getting the Names of the series in my group

Posted: Wed Feb 05, 2014 1:08 pm
by EViews Gareth
If I run the original code you posted on that workfile, I receive an error message of D_CA_XXX_200 is not defined in "Group_CA_SA_XXX.ADD D_CA_XXX_200". Which is a valid error message, since you don't have a series called D_CA_XXX_200.

I can't see what you're trying to do, so can't tell you how to do it.

Re: Getting the Names of the series in my group

Posted: Wed Feb 05, 2014 1:10 pm
by pekaype01
Sorry thats a mistake because of the adapted workfile

Re: Getting the Names of the series in my group

Posted: Wed Feb 05, 2014 1:23 pm
by pekaype01
Sorry the initial post contained the code of the orginail workfile whcih I had to trim down because of upload limitations...thats what happend

This is the code matching the workfile

I want to extract all seriesnames containing *SDN* in the name and add the to the group "group_CA_SA_sedan":


for !i = 1 to errorgroup_sa_d.@count

%model = @mid(errorgroup_sa_d.@seriesname(i), 9)
%sedan = "D_CA_SDN" + %model
group_CA_SA_sedan.add {%sedan}

Next


Error message:

D_CA_SDN is not defined in "group_CA_SEDAN.add D_CA_SDN"

Thanks for your help

Re: Getting the Names of the series in my group

Posted: Wed Feb 05, 2014 1:47 pm
by pekaype01
oh man...wasted 30 minutes on a typo:

Mistake in the parenthesis after seriesname(i). Its missing an exclamation mark before the I.
In case it helps anyone, this is the correct code:

for !i = 1 to errorgroup_sa_d.@count

%model = @mid(errorgroup_sa_d.@seriesname(!i), 10)
%sedan = "D_CA_SDN_" + %model
group_CA_SA_sedan.add {%sedan}

Next