Hello all,
I am new to Eviews and I was wondering if I could do the following. Suppose I have imported the following dataset into Eviews 8:
Obs | Series X | Series Y
#1 | 1 | 1
#2 | 1 | 2
#3 | 2 | 3
#4 | 2 | 4
#5 | 3 | 5
#6 | 3 | 6
For every unique value of Series X I would like to have all of its Series Y values combined (i.e. their mean), such as in the table below:
Obs | Series X | Series Y
#1 | 1 | 1.5
#2 | 2 | 3.5
#3 | 3 | 5.5
I have tried using @uniquevals(series_x) to get all the unique values of Series X. However, the resulting vector doesn't show any information on the values of Series Y. What I would like to do is combine all values of Series Y for each related unique value of Series X (of which there are duplicates). This can be done manually by specifying the sample (i.e. smpl if series_x=1) and then consulting descriptive statistics, however with a larger dataset this quickly becomes cumbersome (I am looking at approximately 1000 unique Series X values). I am looking for a similar function as AVERAGEIF in Excel, however I can't use Excel for other unrelated reasons. Can this be done in an efficient way?
Thank you in advance!
Combining duplicate observations
Moderators: EViews Gareth, EViews Steve, EViews Moderator, EViews Jason
-
startz
- Non-normality and collinearity are NOT problems!
- Posts: 3798
- Joined: Wed Sep 17, 2008 2:25 pm
Re: Combining duplicate observations
check out @meansby
Re: Combining duplicate observations
Thank you so much!
This works to the point that I now have the following output:
Obs | Series X | Series Y
#1 | 1 | 1.5
#2 | 1 | 1.5
#3 | 2 | 3.5
#4 | 2 | 3.5
#5 | 3 | 5.5
#6 | 3 | 5.5
The final thing that I would like to do is remove the duplicate Series X values, to hopefully get:
Obs | Series X | Series Y
#1 | 1 | 1.5
#2 | 2 | 3.5
#3 | 3 | 5.5
@uniquevals(series_x) unfortunately only displays the unique values for Series X. Using this function on a group gives an error. How can I include the related Series Y values?
Thank you in advance!
This works to the point that I now have the following output:
Obs | Series X | Series Y
#1 | 1 | 1.5
#2 | 1 | 1.5
#3 | 2 | 3.5
#4 | 2 | 3.5
#5 | 3 | 5.5
#6 | 3 | 5.5
The final thing that I would like to do is remove the duplicate Series X values, to hopefully get:
Obs | Series X | Series Y
#1 | 1 | 1.5
#2 | 2 | 3.5
#3 | 3 | 5.5
@uniquevals(series_x) unfortunately only displays the unique values for Series X. Using this function on a group gives an error. How can I include the related Series Y values?
Thank you in advance!
-
EViews Glenn
- EViews Developer
- Posts: 2682
- Joined: Wed Oct 15, 2008 9:17 am
Re: Combining duplicate observations
You should create a new EViews page containing the identifiers from the original page (when you click on the new page tab on the bottom of your workfile page, there should be an option to create a new page from identifiers). Then when you copy/link the original series into the new page, EViews will combine the duplicate values to create a unique value for each identifier (the default is to use the mean is what you want).
Who is online
Users browsing this forum: No registered users and 2 guests
