    * Age adjusted Univariate Survival.sps.

    * Written by PSKL on 10/03/03.

    * Produce tables of order statistics of survival curves for two additional descriptive variables.

    Get file = 'D:\Longitudinal Data\Longitudinal Analysis Age group Master 1991 to 2001.sav'.

    weight by weight.

    * Create additional variables.

    Compute chpaygra=chpaygr.
    If (chpaygr=0 and chgepay=0) chpaygra=3.
    If (chpaygr=0 and chgepay=1) chpaygra=4.

    compute Montplac=XDATE.Month((doplacn + YRMODA(1899,12,31))*24*60*60).

    Variable labels chpaygra 'change of charge-paying'
      montplac 'month of restoration placement'.

    Value labels montplac
     1 'January'
     2 'February'
     3 'March'
     4 'April'
     5 'May'
     6 'June'
     7 'July'
     8 'August'
     9 'September'
     10 'October'
     11 'November'
     12 'December'
     /chpaygra
     -1 'not applicable'
      0 'no change'
      1 'non-paying to paying'
      2 'paying to non-paying'
      3 'no change non-payer'
      4 'no change full payer'.
    * First check overall survival.

    KM
      time  /STATUS=reint(1)
        /PRINT MEAN
        /PERCENTILES = (25,35,40,45,50,55,60,65,70,75,80,85,90,95)
        /Save survival (survall).

# Kaplan-Meier

Notes
Output Created | 10-MAR-2003 19:17:36
Comments |
Input | Data | D:\Longitudinal Data\Longitudinal Analysis Age group Master 1991 to 2001.sav
Filter | <none>
Weight | weighting (for time-dependent censor adjustment)
Split File | <none>
N of Rows in Working Data File | 842374
Syntax | KM time /STATUS=reint(1) /PRINT MEAN /PERCENTILES = (25,35,40,45,50,55,60,65,70,75,80,85,90,95) /Save survival (survall).
Resources | Elapsed Time | 0:02:24.38

     Survival Analysis for TIME     Time to reintervention

              Survival Time    Standard Error   95% Confidence Interval

     Mean:      2537.81                 .09     (  2537.64,   2537.98 )
     (Limited to   4016.0 )
     Median:    3004.00                 .45     (  3003.11,   3004.89 )

                                                                   Percentiles

                         25.00        35.00        40.00        45.00        50.00        55.00        60.00        65.00        70.00

     Value                 .            .            .        3771.00      3004.00      2432.00      1965.00      1563.00      1231.00
     Standard Error        .            .            .            .            .45          .31          .24          .19          .14

                                                                   Percentiles

                         75.00        80.00        85.00        90.00        95.00

     Value              949.00       709.00       500.00       321.00       168.00
     Standard Error        .11          .09          .06          .05          .

    >Warning # 3211
    >On at least one case, the value of the weight variable was zero, negative,
    >or missing.  Such cases are invisible to statistical procedures and graphs
    >which need positively weighted cases, but remain on the file and are
    >processed by non-statistical facilities such as LIST and SAVE.

    * Now analyse the new variables.

    KM
      time  /STATUS=reint(1)
        /strata = montplac
        /PRINT MEAN
        /PERCENTILES = (25,35,40,45,50,55,60,65,70,75,80,85,90,95)
        /Save survival (survmpla).

# Kaplan-Meier

Notes
Output Created | 10-MAR-2003 19:21:33
Comments |
Input | Data | D:\Longitudinal Data\Longitudinal Analysis Age group Master 1991 to 2001.sav
Filter | <none>
Weight | weighting (for time-dependent censor adjustment)
Split File | <none>
N of Rows in Working Data File | 842374
Syntax | KM time /STATUS=reint(1) /strata = montplac /PRINT MEAN /PERCENTILES = (25,35,40,45,50,55,60,65,70,75,80,85,90,95) /Save survival (survmpla).
Resources | Elapsed Time | 0:02:48.26

     Survival Analysis for TIME     Time to reintervention

     Strata MONTPLAC = January

              Survival Time    Standard Error   95% Confidence Interval

     Mean:      2511.12                 .29     (  2510.55,   2511.69 )
     (Limited to   4016.0 )
     Median:    2910.00                1.44     (  2907.17,   2912.83 )

                                                                   Percentiles

                         25.00        35.00        40.00        45.00        50.00        55.00        60.00        65.00        70.00

     Value                 .            .            .        3665.00      2910.00      2343.00      1898.00      1518.00      1194.00
     Standard Error        .            .            .            .           1.44         1.01          .76          .60          .48

                                                                   Percentiles

                         75.00        80.00        85.00        90.00        95.00

     Value              908.00       681.00       484.00       312.00       166.00
     Standard Error        .37          .27          .21          .15          .

     Survival Analysis for TIME     Time to reintervention

     Strata MONTPLAC = February

              Survival Time    Standard Error   95% Confidence Interval

     Mean:      2532.31                 .30     (  2531.73,   2532.89 )
     (Limited to   3986.0 )
     Median:    3058.00                1.54     (  3054.98,   3061.02 )

                                                                   Percentiles

                         25.00        35.00        40.00        45.00        50.00        55.00        60.00        65.00        70.00

     Value                 .            .            .        3772.00      3058.00      2449.00      2000.00      1574.00      1236.00
     Standard Error        .            .            .            .           1.54         1.10          .83          .67          .50

                                                                   Percentiles

                         75.00        80.00        85.00        90.00        95.00

     Value              961.00       728.00       513.00       331.00       169.00
     Standard Error        .38          .30          .23          .16          .

     Survival Analysis for TIME     Time to reintervention

     Strata MONTPLAC = March

              Survival Time    Standard Error   95% Confidence Interval

     Mean:      2514.22                 .27     (  2513.68,   2514.76 )
     (Limited to   3958.0 )
     Median:    3001.00                1.54     (  2997.99,   3004.01 )

                                                                   Percentiles

                         25.00        35.00        40.00        45.00        50.00        55.00        60.00        65.00        70.00

     Value                 .            .            .        3858.00      3001.00      2436.00      1936.00      1546.00      1223.00
     Standard Error        .            .            .            .           1.54         1.03          .79          .59          .45

                                                                   Percentiles

                         75.00        80.00        85.00        90.00        95.00

     Value              953.00       721.00       511.00       335.00       180.00
     Standard Error        .35          .27          .21          .15          .

     Survival Analysis for TIME     Time to reintervention

     Strata MONTPLAC = April

              Survival Time    Standard Error   95% Confidence Interval

     Mean:      2532.23                 .29     (  2531.66,   2532.81 )
     (Limited to   3927.0 )
     Median:    3150.00                 .       (      .  ,       .   )

                                                                   Percentiles

                         25.00        35.00        40.00        45.00        50.00        55.00        60.00        65.00        70.00

     Value                 .            .            .            .        3150.00      2571.00      2057.00      1617.00      1261.00
     Standard Error        .            .            .            .            .           1.18          .93          .71          .52

                                                                   Percentiles

                         75.00        80.00        85.00        90.00        95.00

     Value              981.00       729.00       523.00       332.00       173.00
     Standard Error        .40          .31          .23          .17          .

     Survival Analysis for TIME     Time to reintervention

     Strata MONTPLAC = May

              Survival Time    Standard Error   95% Confidence Interval

     Mean:      2487.00                 .29     (  2486.44,   2487.57 )
     (Limited to   3897.0 )
     Median:    2954.00                1.47     (  2951.11,   2956.89 )

                                                                   Percentiles

                         25.00        35.00        40.00        45.00        50.00        55.00        60.00        65.00        70.00

     Value                 .            .            .        3708.00      2954.00      2447.00      1968.00      1593.00      1253.00
     Standard Error        .            .            .            .           1.47         1.02          .82          .63          .51

                                                                   Percentiles

                         75.00        80.00        85.00        90.00        95.00

     Value              972.00       720.00       516.00       329.00       172.00
     Standard Error        .39          .30          .23          .16          .

     Survival Analysis for TIME     Time to reintervention

     Strata MONTPLAC = June

              Survival Time    Standard Error   95% Confidence Interval

     Mean:      2484.06                 .28     (  2483.52,   2484.61 )
     (Limited to   3866.0 )
     Median:    3049.00                1.50     (  3046.07,   3051.93 )

                                                                   Percentiles

                         25.00        35.00        40.00        45.00        50.00        55.00        60.00        65.00        70.00

     Value                 .            .            .        3757.00      3049.00      2454.00      2005.00      1596.00      1254.00
     Standard Error        .            .            .            .           1.50         1.07          .80          .65          .50

                                                                   Percentiles

                         75.00        80.00        85.00        90.00        95.00

     Value              959.00       716.00       511.00       329.00       174.00
     Standard Error        .39          .29          .22          .15          .

     Survival Analysis for TIME     Time to reintervention

     Strata MONTPLAC = July

              Survival Time    Standard Error   95% Confidence Interval

     Mean:      2459.17                 .28     (  2458.63,   2459.72 )
     (Limited to   3836.0 )
     Median:    2980.00                1.42     (  2977.22,   2982.78 )

                                                                   Percentiles

                         25.00        35.00        40.00        45.00        50.00        55.00        60.00        65.00        70.00

     Value                 .            .            .        3668.00      2980.00      2438.00      1968.00      1583.00      1246.00
     Standard Error        .            .            .            .           1.42         1.05          .81          .63          .49

                                                                   Percentiles

                         75.00        80.00        85.00        90.00        95.00

     Value              970.00       727.00       504.00       321.00       173.00
     Standard Error        .38          .31          .23          .15          .

     Survival Analysis for TIME     Time to reintervention

     Strata MONTPLAC = August

              Survival Time    Standard Error   95% Confidence Interval

     Mean:      2444.06                 .30     (  2443.46,   2444.65 )
     (Limited to   3805.0 )
     Median:    3056.00                 .       (      .  ,       .   )

                                                                   Percentiles

                         25.00        35.00        40.00        45.00        50.00        55.00        60.00        65.00        70.00

     Value                 .            .            .            .        3056.00      2443.00      1981.00      1533.00      1202.00
     Standard Error        .            .            .            .            .           1.21          .94          .74          .53

                                                                   Percentiles

                         75.00        80.00        85.00        90.00        95.00

     Value              930.00       685.00       484.00       304.00       161.00
     Standard Error        .41          .32          .23          .16          .

     Survival Analysis for TIME     Time to reintervention

     Strata MONTPLAC = September

              Survival Time    Standard Error   95% Confidence Interval

     Mean:      2400.50                 .28     (  2399.95,   2401.05 )
     (Limited to   3774.0 )
     Median:    2899.00                1.51     (  2896.05,   2901.95 )

                                                                   Percentiles

                         25.00        35.00        40.00        45.00        50.00        55.00        60.00        65.00        70.00

     Value                 .            .            .        3626.00      2899.00      2322.00      1888.00      1509.00      1191.00
     Standard Error        .            .            .            .           1.51         1.05          .78          .61          .48

                                                                   Percentiles

                         75.00        80.00        85.00        90.00        95.00

     Value              913.00       678.00       471.00       299.00       164.00
     Standard Error        .38          .29          .22          .15          .

     Survival Analysis for TIME     Time to reintervention

     Strata MONTPLAC = October

              Survival Time    Standard Error   95% Confidence Interval

     Mean:      2411.82                 .27     (  2411.28,   2412.36 )
     (Limited to   3744.0 )
     Median:    2952.00                1.57     (  2948.92,   2955.08 )

                                                                   Percentiles

                         25.00        35.00        40.00        45.00        50.00        55.00        60.00        65.00        70.00

     Value                 .            .            .        3732.00      2952.00      2390.00      1964.00      1570.00      1247.00
     Standard Error        .            .            .            .           1.57         1.04          .79          .63          .50

                                                                   Percentiles

                         75.00        80.00        85.00        90.00        95.00

     Value              956.00       714.00       501.00       316.00       167.00
     Standard Error        .40          .30          .23          .16          .

     Survival Analysis for TIME     Time to reintervention

     Strata MONTPLAC = November

              Survival Time    Standard Error   95% Confidence Interval

     Mean:      2421.29                 .27     (  2420.76,   2421.81 )
     (Limited to   3713.0 )
     Median:    3078.00                 .       (      .  ,       .   )

                                                                   Percentiles

                         25.00        35.00        40.00        45.00        50.00        55.00        60.00        65.00        70.00

     Value                 .            .            .            .        3078.00      2492.00      2022.00      1605.00      1252.00
     Standard Error        .            .            .            .            .           1.11          .85          .68          .51

                                                                   Percentiles

                         75.00        80.00        85.00        90.00        95.00

     Value              967.00       728.00       517.00       337.00       171.00
     Standard Error        .39          .30          .22          .16          .

     Survival Analysis for TIME     Time to reintervention

     Strata MONTPLAC = December

              Survival Time    Standard Error   95% Confidence Interval

     Mean:      2358.18                 .30     (  2357.60,   2358.76 )
     (Limited to   3683.0 )
     Median:    2913.00                1.66     (  2909.75,   2916.25 )

                                                                   Percentiles

                         25.00        35.00        40.00        45.00        50.00        55.00        60.00        65.00        70.00

     Value                 .            .            .        3657.00      2913.00      2346.00      1862.00      1499.00      1162.00
     Standard Error        .            .            .            .           1.66         1.20          .88          .67          .53

                                                                   Percentiles

                         75.00        80.00        85.00        90.00        95.00

     Value              900.00       661.00       460.00       293.00       151.00
     Standard Error        .40          .32          .23          .16          .

     Survival Analysis for TIME     Time to reintervention

                                      Total      Number       Number        Percent
                                                 Events      Censored      Censored

    MONTPLAC        January          ******      ******       ******          65.09

    MONTPLAC        February         ******      ******       ******          66.51

    MONTPLAC        March            ******      ******       ******          66.50

    MONTPLAC        April            ******      ******       ******          67.44

    MONTPLAC        May              ******      ******       ******          67.09

    MONTPLAC        June             ******      ******       ******          67.66

    MONTPLAC        July             ******      ******       ******          67.57

    MONTPLAC        August           ******      ******       ******          68.04

    MONTPLAC        September        ******      ******       ******          67.32

    MONTPLAC        October          ******      ******       ******          68.57

    MONTPLAC        November         ******      ******       ******          69.50

    MONTPLAC        December         ******      ******       ******          68.26

    Overall                        ********    ********     ********          67.45

    >Warning # 3211
    >On at least one case, the value of the weight variable was zero, negative,
    >or missing.  Such cases are invisible to statistical procedures and graphs
    >which need positively weighted cases, but remain on the file and are
    >processed by non-statistical facilities such as LIST and SAVE.

    KM
      time  /STATUS=reint(1)
        /strata = chpaygra
        /PRINT MEAN
        /PERCENTILES = (25,35,40,45,50,55,60,65,70,75,80,85,90,95)
        /Save survival (survchpg).

# Kaplan-Meier

Notes
Output Created | 10-MAR-2003 19:28:50
Comments |
Input | Data | D:\Longitudinal Data\Longitudinal Analysis Age group Master 1991 to 2001.sav
Filter | <none>
Weight | weighting (for time-dependent censor adjustment)
Split File | <none>
N of Rows in Working Data File | 842374
Syntax | KM time /STATUS=reint(1) /strata = chpaygra /PRINT MEAN /PERCENTILES = (25,35,40,45,50,55,60,65,70,75,80,85,90,95) /Save survival (survchpg).
Resources | Elapsed Time | 0:04:20.94

     Survival Analysis for TIME     Time to reintervention

     Strata CHPAYGRA = not applicable

    >Warning # 20077.  Command name: KM
    >Survival estimates cannot be computed since all observations are censored.

     Survival Analysis for TIME     Time to reintervention

     Strata CHPAYGRA = non-paying to paying

              Survival Time    Standard Error   95% Confidence Interval

     Mean:      2468.33                 .22     (  2467.91,   2468.76 )
     (Limited to   4016.0 )
     Median:    2780.00                 .93     (  2778.17,   2781.83 )

                                                                   Percentiles

                         25.00        35.00        40.00        45.00        50.00        55.00        60.00        65.00        70.00

     Value                 .            .            .        3472.00      2780.00      2248.00      1820.00      1438.00      1114.00
     Standard Error        .            .            .            .            .93          .68          .54          .44          .35

                                                                   Percentiles

                         75.00        80.00        85.00        90.00        95.00

     Value              854.00       620.00       429.00       267.00       141.00
     Standard Error        .27          .22          .16          .11          .

     Survival Analysis for TIME     Time to reintervention

     Strata CHPAYGRA = paying to non-paying

              Survival Time    Standard Error   95% Confidence Interval

     Mean:      2432.08                 .28     (  2431.54,   2432.62 )
     (Limited to   4016.0 )
     Median:    2586.00                1.00     (  2584.04,   2587.96 )

                                                                   Percentiles

                         25.00        35.00        40.00        45.00        50.00        55.00        60.00        65.00        70.00

     Value                 .            .            .        3191.00      2586.00      2127.00      1726.00      1383.00      1106.00
     Standard Error        .            .            .            .           1.00          .77          .63          .50          .40

                                                                   Percentiles

                         75.00        80.00        85.00        90.00        95.00

     Value              865.00       644.00       464.00       302.00       167.00
     Standard Error        .33          .27          .20          .15          .

     Survival Analysis for TIME     Time to reintervention

     Strata CHPAYGRA = no change non-payer

              Survival Time    Standard Error   95% Confidence Interval

     Mean:      2354.58                 .24     (  2354.11,   2355.05 )
     (Limited to   4016.0 )
     Median:    2409.00                 .82     (  2407.40,   2410.60 )

                                                                   Percentiles

                         25.00        35.00        40.00        45.00        50.00        55.00        60.00        65.00        70.00

     Value                 .            .        3661.00      2955.00      2409.00      1966.00      1595.00      1266.00       998.00
     Standard Error        .            .            .           1.19          .82          .61          .48          .38          .29

                                                                   Percentiles

                         75.00        80.00        85.00        90.00        95.00

     Value              765.00       562.00       379.00       232.00       132.00
     Standard Error        .23          .18          .14          .09          .

     Survival Analysis for TIME     Time to reintervention

     Strata CHPAYGRA = no change full payer

              Survival Time    Standard Error   95% Confidence Interval

     Mean:      2526.92                 .12     (  2526.69,   2527.15 )
     (Limited to   4016.0 )
     Median:    3031.00                 .62     (  3029.79,   3032.21 )

                                                                   Percentiles

                         25.00        35.00        40.00        45.00        50.00        55.00        60.00        65.00        70.00

     Value                 .            .            .        3810.00      3031.00      2428.00      1937.00      1526.00      1189.00
     Standard Error        .            .            .            .            .62          .43          .33          .25          .19

                                                                   Percentiles

                         75.00        80.00        85.00        90.00        95.00

     Value              908.00       666.00       455.00       281.00       154.00
     Standard Error        .15          .12          .09          .06          .

     Survival Analysis for TIME     Time to reintervention

                                           Total   Number    Number     Percent
                                                   Events   Censored   Censored

    CHPAYGRA     not applicable           ******        0    ******      100.00

    CHPAYGRA     non-paying to paying     ******   ******    ******       57.31

    CHPAYGRA     paying to non-paying     ******   ******    ******       54.47

    CHPAYGRA     no change non-payer      ******   ******    ******       63.94

    CHPAYGRA     no change full payer     ******   ******    ******       64.08

    Overall                             ******** ********  ********       67.45

    >Warning # 3211
    >On at least one case, the value of the weight variable was zero, negative,
    >or missing.  Such cases are invisible to statistical procedures and graphs
    >which need positively weighted cases, but remain on the file and are
    >processed by non-statistical facilities such as LIST and SAVE.

    weight off.

    Save outfile='D:\temp1.sav'.
    ********************************************************************************************************.
    * Create Excel file for plotting.

    Get file='D:\temp1.sav'.

    select if (reint=1).

    sort cases by time.

    If (Montplac = 1) Mont1=survmpla.
    If (Montplac = 2) Mont2=survmpla.
    If (Montplac = 3) Mont3=survmpla.
    If (Montplac = 4) Mont4=survmpla.
    If (Montplac = 5) Mont5=survmpla.
    If (Montplac = 6) Mont6=survmpla.
    If (Montplac = 7) Mont7=survmpla.
    If (Montplac = 8) Mont8=survmpla.
    If (Montplac = 9) Mont9=survmpla.
    If (Montplac = 10) Mont10=survmpla.
    If (Montplac = 11) Mont11=survmpla.
    If (Montplac = 12) Mont12=survmpla.

    If (chpaygra = 1)   chpaygr1 = survchpg.
    If (chpaygra = 2)   chpaygr2 = survchpg.
    If (chpaygra = 3)   chpaygr3 = survchpg.
    If (chpaygra = 4)   chpaygr4 = survchpg.

    aggregate outfile=*
     /presorted
     /break time
     / survall mont1 mont2 mont3 mont4 mont5 mont6 mont7 mont8 mont9 mont10 mont11 mont12
      chpaygr1 chpaygr2 chpaygr3 chpaygr4
      = max(survall mont1 mont2 mont3 mont4 mont5 mont6 mont7 mont8 mont9 mont10 mont11 mont12
      chpaygr1 chpaygr2 chpaygr3 chpaygr4).
    Save outfile='D:\Longitudinal Data\Age adjusted Univariate Survival supplement.sav'.

    SAVE TRANSLATE OUTFILE='I:\Research Projects\Longevity\Univariate Survival 1 supplement.xls'
      /TYPE=XLS /MAP /REPLACE /FIELDNAMES.

    Data written to I:\Research Projects\Longevity\Univariate Survival 1 supplement.xls.
    18 variables and 3783 cases written to range: SPSS.
    Variable: TIME       Type: Number   Width:  8   Dec: 2
    Variable: SURVALL    Type: Number   Width: 10   Dec: 5
    Variable: MONT1      Type: Number   Width:  8   Dec: 2
    Variable: MONT2      Type: Number   Width:  8   Dec: 2
    Variable: MONT3      Type: Number   Width:  8   Dec: 2
    Variable: MONT4      Type: Number   Width:  8   Dec: 2
    Variable: MONT5      Type: Number   Width:  8   Dec: 2
    Variable: MONT6      Type: Number   Width:  8   Dec: 2
    Variable: MONT7      Type: Number   Width:  8   Dec: 2
    Variable: MONT8      Type: Number   Width:  8   Dec: 2
    Variable: MONT9      Type: Number   Width:  8   Dec: 2
    Variable: MONT10     Type: Number   Width:  8   Dec: 2
    Variable: MONT11     Type: Number   Width:  8   Dec: 2
    Variable: MONT12     Type: Number   Width:  8   Dec: 2
    Variable: CHPAYGR1   Type: Number   Width:  8   Dec: 2
    Variable: CHPAYGR2   Type: Number   Width:  8   Dec: 2
    Variable: CHPAYGR3   Type: Number   Width:  8   Dec: 2
    Variable: CHPAYGR4   Type: Number   Width:  8   Dec: 2