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 RatesHope you guys can help.
Thanks
Davey
