Getting the Names of the series in my group
Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt
Getting the Names of the series in my group
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.
e.g.
group g1 apple pear banana
I want to get the word apple pear and banana out.
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13604
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Getting the Names of the series in my group
Group.@members
Or
Group.@seriesname(1)
Or
Group.@seriesname(1)
Re: Getting the Names of the series in my group
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)?
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)?
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13604
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Getting the Names of the series in my group
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.
I don't understand your second question.
Re: Getting the Names of the series in my group
THank you for your reply!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.
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!
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13604
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Getting the Names of the series in my group
You can't rename a series and keep it in a group, no.
You probably want the @mid function rather than @right
You probably want the @mid function rather than @right
Re: Getting the Names of the series in my group
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
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
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13604
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Getting the Names of the series in my group
Can't see anything wrong. Could you post your workfile?
Re: Getting the Names of the series in my group
one second..the workfile is too large to be uploaded. I will resize it
Re: Getting the Names of the series in my group
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),
%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
Here is the code that I am Using again:
for !i = 1 to errorgroup_sa_d.@count
%model = @mid(errorgroup_sa_d.@seriesname(i),
%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
- Attachments
-
- 140205 check.wf1
- (153.17 KiB) Downloaded 271 times
Re: Getting the Names of the series in my group
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
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
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13604
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Getting the Names of the series in my group
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.
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
Sorry thats a mistake because of the adapted workfile
Last edited by pekaype01 on Wed Feb 05, 2014 1:24 pm, edited 1 time in total.
Re: Getting the Names of the series in my group
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
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
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
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
Who is online
Users browsing this forum: No registered users and 1 guest
