Performing calcs using 2 separate pages within workfile

For questions regarding programming in the EViews programming language.

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

davey87
Posts: 24
Joined: Tue Feb 05, 2013 12:18 pm

Performing calcs using 2 separate pages within workfile

Postby davey87 » Thu Dec 12, 2013 1:14 pm

Hi,

I have a workfile with two separate pages. The first page is called "LTC" and the second page is called "POP".

The LTC page contains counts by age and sex of long-term care residents for 2012.

The POP page contains a time-series of population data by age and sex for the years 2012-2036.

I want to perform a calculation using data from both pages and have the result displayed in a third page called "RATE".

Specifically, I want to divide the age and sex specific counts in the LTC page by the corresponding age and sex specific counts in the POP page for the year 2012 only.

My main issue here is I do not know how to interact and use data between separate pages within a workfile to perform calculations.

Here is my code (I deliberately left out the majority of my "import" commands from my code here for confidentiality purposes):

Code: Select all

wfcreate(wf=NL, page=LTC) u 1 import... 'Calculate total residents series totalres totalres=0 for %g f m totalres=totalres+{%g}6569+{%g}7074+{%g}7579+{%g}8084+{%g}85plus next totalres.setformat f.0 'Calculate distributions for %g f m for %c 6569 7074 7579 8084 85plus series d{%g}{%c}={%g}{%c}/totalres next next 'Input total number of LTC beds series numbeds numbeds=2740 numbeds.setformat f.0 'Apply distributions to total number of LTC beds for %g f m for %c 6569 7074 7579 8084 85plus series b{%g}{%c}=@round(d{%g}{%c}*numbeds) b{%g}{%c}.setformat f.0 next next 'Import 2012-2036 population and create new page for it pagecreate(page=POP) a 2012 2036 import... 'Calculate 2012 Use Rates
I am aware that I could avoid all of this by simply importing all of my data into one page, however I want to know how to interact between pages as I think it will benefit me moving forward.

Hope you guys can help.

Thanks

Davey

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13604
Joined: Tue Sep 16, 2008 5:38 pm

Re: Performing calcs using 2 separate pages within workfile

Postby EViews Gareth » Thu Dec 12, 2013 1:52 pm

Copy the series from one page to another, using the copy command.


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests