The SAS and SPSS programmes for calculating health ...ec.· The SAS and SPSS programmes for calculating

  • View
    215

  • Download
    0

Embed Size (px)

Text of The SAS and SPSS programmes for calculating health ...ec.· The SAS and SPSS programmes for...

  • EHEMU Technical report 2007_6 June 2007

    The SAS and SPSS programmes for calculating health expectancies

    Report written by Bianca Cox

  • 1

    The EHEMU team comprises:

    Jean-Marie Robine, Health and Demography, Universit de Montpellier, France,

    robine@valdorel.fnclcc.fr

    Carol Jagger, University of Leicester, United-Kingdom, cxj@leicester.ac.uk

    Herman van Oyen, Scientific Institute of Public Health, Belgium, HVanOyen@iph.fgov.be

    Emmanuelle Cambois, INED (Institut National dEtudes Dmographiques), France, Cambois@ined.fr

    Bianca Cox, Scientific Institute of Public Health, Belgium, bianca.cox@iph.fgov.be

    Isabelle Romieu, Health and Demography, Universit de Montpellier, France,

    iromieu@valdorel.fnclcc.fr

    Aurore Clavel, Health and Demography, Universit de Montpellier, France,

    aurore.clavel@valdorel.fnclcc.fr

    Sophie Le Roy, Health and Demography, Universit de Montpellier, France, sleroy@valdorel.fnclcc.fr

    Contact EHEMU: Isabelle Romieu Equipe Dmographie et Sant, Centre Val d'Aurelle, Parc Euromdecine, 34298 Montpellier cedex 5, France. Tel: +33 (0) 467 61 30 27 Fax: +33 (0) 467 61 37 87 Email: iromieu@valdorel.fnclcc.fr

    mailto:robine@valdorel.fnclcc.frmailto:cxj@leicester.ac.ukmailto:HVanOyen@iph.fgov.bemailto:Cambois@ined.frmailto:bianca.cox@iph.fgov.bemailto:iromieu@valdorel.fnclcc.frmailto:aurore.clavel@valdorel.fnclcc.frmailto:sleroy@valdorel.fnclcc.frmailto:iromieu@valdorel.fnclcc.fr

  • 2

    SAS and SPSS programs for calculating health expectancies In addition to the Excel spreadsheet, SAS and SPSS programs are provided for calculating health

    expectancies. The programs contain the examples presented in the Calculation Guide. Both programs

    are provided in text form (Word document) so that they can also be viewed by users who dont have

    SAS or SPSS software. In order to use the program, select the text from the Word document and copy

    it into the command window of the corresponding software (named Editor in SAS and Syntax in

    SPSS).

    The input data needed for both programs are provided in the Excel files: input_examples.xls. In the

    SAS and SPSS programs, you only need to change the name of the directory in which the input and

    output datasets are stored. After running the program, eight output datasets are produced: example1,

    example2, example3, example4A, example4B, example5, example6A and example6B. The

    extensions of these datasets are .sas7bdat for SAS and .sav for SPSS. The programs can also be

    used on other data, provided that the input data are supplied in the same format.

  • 3

    Excel spreadsheets Input_example1:

    x Px Dx Px1 Dx2 B pix 0 54795,5 202 54934 170 56189 0 1 54818 21 0,048 2 55665,5 11 0,048 3 55969,5 8 0,048 4 55805,5 12 0,048 5 56401,5 8 0,03 6 57484,5 6 0,03 7 58296,5 11 0,03 8 58676,5 5 0,03 9 59682 6 0,03

    10 61938,5 2 0,072 11 63185 5 0,072 12 63177 13 0,072 13 61984,5 9 0,072 14 60475 9 0,072 15 59806 10 0,098 16 58949,5 10 0,098 17 59076 12 0,098 18 59094,5 23 0,098 19 60558,5 24 0,098 20 61594,5 14 0,087 21 62947,5 27 0,087 22 64011 23 0,087 23 64035,5 24 0,087 24 62941,5 16 0,087 25 63049,5 20 0,096 26 63079,5 25 0,096 27 63313 30 0,096 28 63587,5 21 0,096 29 66030 25 0,096 30 67970 29 0,089 31 70468 30 0,089 32 72499 24 0,089 33 73138,5 37 0,089 34 73895,5 44 0,089 35 74710 52 0,142 36 76245,5 61 0,142 37 79016,5 61 0,142 38 80763 60 0,142 39 82647,5 79 0,142 40 81702 82 0,122 41 80813 103 0,122 42 81101 96 0,122 43 80078,5 104 0,122 44 80162 114 0,122 45 78173 123 0,195 46 76508 132 0,195 47 75315 167 0,195 48 73965,5 146 0,195 49 73183,5 196 0,195 50 72064,5 199 0,161 51 71936,5 229 0,161

  • 4

    52 71115,5 264 0,161 53 71959 287 0,161 54 70745,5 285 0,161 55 69591 307 0,298 56 66630 285 0,298 57 64055 261 0,298 58 56176,5 236 0,298 59 54783 234 0,298 60 51870 264 0,234 61 47611,5 301 0,234 62 46013 328 0,234 63 50033 351 0,234 64 52686 366 0,234 65 53073 365 0,257 66 51635,5 468 0,257 67 51718,5 495 0,257 68 51932,5 580 0,257 69 52759,5 692 0,257 70 52804 738 0,345 71 53988,5 809 0,345 72 53496,5 840 0,345 73 52671,5 944 0,345 74 49530,5 1059 0,345 75 49546,5 1161 0,431 76 49715 1532 0,431 77 49928 1887 0,431 78 48534,5 2042 0,431 79 45249 2121 0,431 80 41393,5 2049 0,431 81 36644 1765 0,431 82 32714 1435 0,431 83 28395 1038 0,431 84 20277,5 1201 0,431 85 125152 23298 0,513

    Input_example4:

    agegr Nx 0 52 1 230 5 257

    10 275 15 281 20 342 25 402 30 426 35 437 40 446 45 438 50 424 55 407 60 310 65 398 70 413 75 310 80 300 85 647

  • 5

    Input_example5: agegr DFLEf S_DFLEf DFLEm S_DFLEm

    0 66,5 0,36 63,5 0,33 1 65,8 0,36 62,7 0,33 5 62,0 0,35 58,9 0,33

    10 57,2 0,35 54,2 0,32 15 52,6 0,34 49,6 0,32 20 48,2 0,33 45,0 0,31 25 43,7 0,32 40,5 0,31 30 39,2 0,31 36,0 0,30 35 34,8 0,31 31,7 0,29 40 30,6 0,29 27,5 0,28 45 26,4 0,29 23,8 0,27 50 22,6 0,27 20,1 0,26 55 18,8 0,26 16,9 0,24 60 15,6 0,24 13,5 0,23 65 12,3 0,22 10,6 0,21 70 9,1 0,20 7,8 0,20 75 6,5 0,18 5,4 0,19 80 4,6 0,15 3,9 0,18 85 2,6 0,11 2,6 0,16

    Input_example6: agegr Ix

    0 0 1 0 5 0

    10 0 15 0 20 0 25 0,001 30 0,001 35 0,001 40 0,002 45 0,002 50 0,003 55 0,003 60 0,006 65 0,009 70 0,019 75 0,047 80 0,11 85 0,297

  • 6

    SAS Program

    LIBNAME Sullivan "_____"; /* Specify the directory where you want to save the output data */ /*************************************************************************/ /* SULLIVAN HEALTH EXPECTANCY USING AN UNABRIDGED LIFE TABLE: EXAMPLE 1 */ /*************************************************************************/

    /******** Calculation of the life table and life expectancy ********/ PROC IMPORT OUT= WORK.input_example1 DATAFILE= "_____\input_examples.xls" /* Specify the directory of the input data */ DBMS=EXCEL REPLACE; SHEET="input_example1$"; GETNAMES=YES; MIXED=NO; SCANTEXT=YES; USEDATE=YES; SCANTIME=YES; RUN; DATA example1; RETAIN x Px Dx mx qx rx pix; SET input_example1; mx=Dx/Px; qx=mx/(1+(0.5*mx)); IF x=0 THEN qx=1-(1-((Dx-Dx2)/Px1))*(1-(Dx2/B)); IF x=85 THEN qx=.; rx=1-qx; DROP Px1 Dx2 B; FORMAT Dx 6.0 Px 8.1 pix 5.3 mx qx rx 8.6; RUN; PROC EXPAND DATA=example1 OUT=example1 (DROP=time) METHOD=NONE; CONVERT rx=rxrx / TRANSFORM=(PRODUCT); RUN; DATA example1; RETAIN x Px Dx mx qx lx pix; SET example1; lagrxrx=LAG(rxrx); IF x=0 THEN lx=100000; ELSE lx=100000*lagrxrx; DROP rx rxrx lagrxrx; FORMAT lx 9.2; RUN; PROC SORT DATA=example1 OUT=example1; BY DESCENDING x; RUN; DATA example1; RETAIN x Px Dx mx qx lx LLx pix; SET example1; laglx=LAG(lx); LLx=(lx+laglx)/2; IF x=0 THEN LLx=0.2*lx+0.8*laglx; IF x=85 THEN LLx=lx/mx; DROP laglx; FORMAT Llx 10.2; RUN; PROC EXPAND DATA=example1 OUT=example1 (DROP=time) METHOD=NONE; CONVERT LLx=Tx / TRANSFORM=(SUM); RUN; PROC SORT DATA=example1 OUT=example1; BY x; RUN;

  • 7

    DATA example1; RETAIN x Px Dx mx qx lx LLx Tx ex pix; SET example1; ex=Tx/lx; FORMAT ex 4.1; RUN; /******** Calculation of Disability-Free Life Expectancy (DFLE) ********/

    DATA example1; SET example1; LLx_disafr=LLx*(1-pix); FORMAT LLx_disafr 10.2; RUN; PROC SORT DATA=example1 OUT=example1; BY DESCENDING x; RUN; PROC EXPAND DATA=example1 OUT=example1 (DROP=time) METHOD=NONE; CONVERT LLx_disafr=Tx_disafr / TRANSFORM=(SUM); RUN; PROC SORT DATA=example1 OUT=example1; BY x; RUN; DATA example1; RETAIN x Px Dx mx qx lx LLx Tx ex pix LLx_disafr Tx_disafr DFLEx percDFLEx; SET example1; DFLEx=Tx_disafr/lx; percDFLEx=100*(DFLEx/ex); FORMAT DFLEx percDFLEx 4.1 ; RUN; DATA Sullivan.example1; SET example1; LABEL x='Age' Px='Mid-year population' Dx='No. deaths' mx='Central Death rate' qx='Conditional probability of death' lx='Numbers surviving to age x' LLx='Person years lived at age x' Tx='Total number of years lived from age x' ex='Total life Expectancy' pix='Proportion with disability' LLx_disafr='Person years lived without disability at age x' Tx_disafr='Total years lived without disability from age x' DFLEx='Disability-free life expectancy' percDFLEx='Proportion of life spent disability-free'; RUN; /*************************************************************************/ /*SULLIVAN HEALTH EXPECTANCY USING AN UNABRIDGED LIFE TABLE : EXAMPLE 2 */ /*************************************************************************/

    /******** Calculation of the life table and life expectancy ********/ PROC FORMAT library=work; VALUE agegr 0='0' 1='1-4' 5='5-9' 10='10-14' 15='15-19' 20='20-24' 25='25-29' 30='30-34' 35='35-39' 40='40-44' 45='45-49' 50='50-54' 55='55-59' 60='60-64' 65='65-69' 70='70-74' 75='75-79' 80='80-84' 85='85+'; RUN;

  • 8

    DATA input_example2; RETAIN x agegr lx LLx pix; SET example1; FORMAT agegr agegr.; IF x=0 THEN agegr=0; IF (x ge 1 and x le 4) THEN agegr=1; IF (x ge 5 and x le 9) THEN agegr=5; IF (x ge 10 and x le 14) THEN agegr=10; IF (x ge 15 and x le 19) THEN agegr=15; IF (x ge 20 and x le 24) THEN agegr=20; IF (x ge 25 and x le 29) THEN agegr=25; IF (x ge 30 and x le 34) THEN agegr=30; IF (x ge 35 and x le 39) THEN agegr=35; IF (x ge 40 and x le 44) THEN agegr=40; IF (x ge 45 and x le 49) THEN agegr=45; IF (x ge 50 and x le 54) THEN agegr=50; IF (x ge 55 and x le 59) THEN agegr=55; IF (x ge 60 and x le 64) THEN agegr=60; IF (x ge 65 and x le 69) THEN agegr=65; IF (x ge 70 and x le 74) THEN agegr=70; IF (x ge 75 and x le 79) THEN agegr=75; IF (x ge 80 and x le 84) THEN agegr=80; IF (x ge 85) THEN agegr=85; KEEP x agegr