Hello,
I am trying to determine if it is possible to create a new series based on 2 older series, in a separate page within the same workfile.
For example, in one workfile page I have population projection numbers for females by age group, and in the other workfile page I have population projection numbers for males by age group. It looks something like this:
Female Page:
p0to4f
p10to14f
.
.
.
p90plusf
Male Page:
p0to4m
p10to14m
.
.
.
p90plusm
I want to know if I can create a third workfile page called "Total", which references the previous two workfile pages and adds the female and male totals for each age group from them.
For example, "Total" would look like:
Total:
p0to4t = p0to4f + p0to4m
p10to14t = p10to14f + p10to14m
.
.
.
p90plust = p90plusf +p90plusm
If this is infact possible, could you provide some sample code as to the best way to do this?
Thanks!
Creating a new series from older series in new workfile page
Moderators: EViews Gareth, EViews Steve, EViews Moderator, EViews Jason
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13604
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Creating a new series from older series in new workfile
Just copy the series over to the new page (using the mouse, or the copy command), then use a command such as:
Code: Select all
series p0to4t = p0to4f + p0to4m
Re: Creating a new series from older series in new workfile
Ok what about this scenario:
I have a workfile open with two separate pages. One page contains population projections for economic zone 1 for female, male and total, and the other page contains population projections for economic zone 2 for female, male and total. Within each page the variable names are exactly the same. For example:
Zone 1:
p0to4
p0to4f
p0to4m
p10to14
p10to14f
p10to14m
.
.
.
p90plus
p90plusf
p90plusm
Zone 2:
p0to4
p0to4f
p0to4m
p10to14
p10to14f
p10to14m
.
.
.
p90plus
p90plusf
p90plusm
The reason the data is set up this way is because it has been imported from AREMOS, which we have used for the last 20 years for our projections. Within the AREMOS environment, you can reference separate databanks within the code, even if the data within each bank contains the same variable names.
Is it possible in EViews to create a new series in a new page that sums each age group from each economic zone, given that the variable names are identical within each of the two previous pages?
For example:
In a separate page, can I generate a series such that:
p0to4total = p0to4 (from series 1, page 1) + p0to4 (from series 2, page 2)
p0to4totalf = p0to4f (from series 1, page 1) + p0to4f (from series 2, page 2)
p0to4totalm = p0to4m (from series 1, page 1) + p0to4m (from series 2, page 2)
.
.
.
I tried to do this the way you suggested in response to my previous post, however because the variable names are identical, when I tried to copy the second page over to the new page, it said p0to4 already exists in the workfile. Hence, to do it this way I would have to rename every variable.
I am trying to avoid having to go back and rename every single variable in every single databank from AREMOS. We have over 20 economic zones and low, medium and high scenarios for each zone. It would take forever to do so, and I’m sure there is a better way.
I have a workfile open with two separate pages. One page contains population projections for economic zone 1 for female, male and total, and the other page contains population projections for economic zone 2 for female, male and total. Within each page the variable names are exactly the same. For example:
Zone 1:
p0to4
p0to4f
p0to4m
p10to14
p10to14f
p10to14m
.
.
.
p90plus
p90plusf
p90plusm
Zone 2:
p0to4
p0to4f
p0to4m
p10to14
p10to14f
p10to14m
.
.
.
p90plus
p90plusf
p90plusm
The reason the data is set up this way is because it has been imported from AREMOS, which we have used for the last 20 years for our projections. Within the AREMOS environment, you can reference separate databanks within the code, even if the data within each bank contains the same variable names.
Is it possible in EViews to create a new series in a new page that sums each age group from each economic zone, given that the variable names are identical within each of the two previous pages?
For example:
In a separate page, can I generate a series such that:
p0to4total = p0to4 (from series 1, page 1) + p0to4 (from series 2, page 2)
p0to4totalf = p0to4f (from series 1, page 1) + p0to4f (from series 2, page 2)
p0to4totalm = p0to4m (from series 1, page 1) + p0to4m (from series 2, page 2)
.
.
.
I tried to do this the way you suggested in response to my previous post, however because the variable names are identical, when I tried to copy the second page over to the new page, it said p0to4 already exists in the workfile. Hence, to do it this way I would have to rename every variable.
I am trying to avoid having to go back and rename every single variable in every single databank from AREMOS. We have over 20 economic zones and low, medium and high scenarios for each zone. It would take forever to do so, and I’m sure there is a better way.
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13604
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Creating a new series from older series in new workfile
You'll have to rename, either in the source pages or in the destination page.
It shouldn't take more than a couple of lines of code to achieve.
It shouldn't take more than a couple of lines of code to achieve.
Who is online
Users browsing this forum: No registered users and 2 guests
