Hello,
I am trying to create a matched sample using hazard ratios by observation by id. I am conducting a study on the influence of a bill (treatment in dollars) to students who withdraw (exposure event) from a university. However, the treatment occurs too rarely to be measured and the model is not sufficient as I have confounders in my variable set. Further, the exposure event of withdraw is related (precedes) degree attainment (dependent outcome of interest).

I am attempting to mimic a method used by Dr. Bo Lu in "Propensity Score Matching with Time-Dependent Covariates" to use hazards as a propensity score to create a matched sample of subjects who experience the exposure event and those who never experience this event. I have searched heavily to find help for this but have not had luck in securing it. I am hoping someone here may have some suggestions/direction.

My dataset consists of 10559 subjects with 123719 records/ periods of observations. An example of my data is below - I used cube roots for dollar variables. My treatment is the amount of bill, but this occurs very infrequently. It requires a subject withdraw from the university to have a chance of experiencing a bill, thus I am interested in balancing my covariates to this event (WD_event). Nearly 600 subjects experienced at least once (some 2, 3 or 6 times during the period of observation). I used Cox regression to create my model, but when I generate the hazard variable =h, I only see about 17,000 hazards generated.

My question: How do I create hazard ratios for each observation in my dataset? How do I get Stata to use these hazards to create a matched sample of treated and untreated (WD_event) subjects for my final model which looks at a terminal outcome (degree attainment)? Any guidance would be appreciated.

Reference: Lu, B. (2005). Propensity Score Matching with Time-Dependent Covariates. Biometrics, 61(3), 721–728. https://doi.org/10.1111/j.1541-0420.2005.00356.x

Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input str10 SID float(WD_event curt_bill) byte(FEMALE URETHNICITY) double HSGPA byte(IND RESIDENCY Housing) float(cum_GPA curt_TI curt_networth curt_semp curt_giftfuo curt_stuloan curt_plus)
"12345" 0         0 0 0 3.63 0 1 0      1.36  54.92795  37.91602  11.84761         0         0         0
"12345" 0         0 0 0 3.63 0 1 0      2.23  54.92795  37.91602  11.84761         0         0         0
"12345" 0         0 0 0 3.63 0 1 0 2.3566666  54.92795  37.91602  11.84761         0         0         0
"12345" 0         0 0 0 3.63 0 1 1    2.5675  54.06861  37.44793 16.375246         0 11.408857         0
"12345" 0         0 0 0 3.63 0 1 1     2.786  54.06861  37.44793 16.375246         0 11.408857         0
"12345" 1  8.440975 0 0 3.63 0 1 1 2.3216667  54.06861  37.44793 16.375246         0 11.408857         0
"23456" 0         0 0 0 3.18 0 0 0      3.66  42.74466  12.59921         0 13.836535         0         0
"23456" 0         0 0 0 3.18 0 0 0      3.11  42.74466  12.59921         0 13.836535         0         0
"23456" 0         0 0 0 3.18 0 0 0      2.85  42.74466  12.59921         0 13.836535         0         0
"23456" 0         0 0 0 3.18 0 0 0     2.575  48.16408  7.937005 10.322802 10.558255         0         0
"23456" 0         0 0 0 3.18 0 0 0      2.72  48.16408  7.937005 10.322802 10.558255         0         0
"23456" 0         0 0 0 3.18 0 0 0 2.6333334  48.16408  7.937005 10.322802 10.564232         0         0
"23456" 0         0 0 0 3.18 0 0 1  2.685714  49.46087         0 18.395565         0  12.92062 18.147957
"23456" 0         0 0 0 3.18 0 0 1      2.35  49.46087         0 18.395565         0  12.92062 18.147957
"23456" 0         0 0 0 3.18 0 0 1  2.426667  49.46087         0 18.395565         0 12.918624  18.14897
"23456" 0         0 0 0 3.18 0 0 1     2.394   44.9258 8.2228985 22.722565  6.073178 15.511265 17.289171
"23456" 0         0 0 0 3.18 0 0 1  2.421818   44.9258 8.2228985 22.722565         0 15.511265         0
"23456" 0         0 0 0 3.18 0 0 1  2.386667  45.29989 11.362574 22.722565 8.5726185         0         0
"23456" 1         0 0 0 3.18 0 0 1 2.2030768  45.29989 11.362574 22.722565         0         0         0
"23456" 0         0 1 0 3.11 0 0 0      2.54  49.21026 18.171206 16.130444         0  9.517052         0
"23456" 0         0 1 0 3.11 0 0 0      2.77  49.21026 18.171206 16.130444         0  9.517052         0
"23456" 1         0 1 0 3.11 0 0 0 1.8466667  49.21026 18.171206 16.130444         0  9.517052         0
"23456" 1  7.945991 1 0 3.11 0 0 1     1.385  52.71893   22.2398  16.06484         0 10.495085         0
"34567" 0         0 1 0 3.11 0 0 1      1.62  54.92121 27.144176  12.15313         0  10.51321         0
"34567" 0         0 1 0 3.11 0 0 1 1.6833333  54.92121 27.144176  12.15313         0  10.51321         0
"34567" 1         0 1 0 3.11 0 0 1  1.442857  54.92121 27.144176  12.15313         0 10.510194         0
"34567" 0         0 1 0 3.11 0 0 1   1.43125   59.9198  21.68703 12.385623         0  20.50783         0
"34567" 0         0 1 0 3.11 0 0 1  1.438889   59.9198  21.68703 12.385623         0  12.92062         0
"34567" 0         0 1 0 3.11 0 0 1     1.295   59.9198  21.68703 12.385623         0 12.918624         0
"34567" 1  9.782434 1 0 3.11 0 0 1 1.1772727  62.48339 32.710663 17.213007         0  12.92062         0
"34567" 0         0 1 0 3.11 1 0 1 1.3041667 12.848336         0 18.197416 18.955574  15.78622         0
"34567" 0         0 1 0 3.11 1 0 1  1.473077 12.848336         0 18.197416 18.955574  15.78622         0
"34567" 0         0 1 0 3.11 1 0 1  1.367857 12.848336         0 18.197416 18.955574 14.760645         0
"34567" 0         0 1 0 3.11 1 0 1 1.4766667 12.848336         0 18.197416 12.050712 10.877427         0
"34567" 0         0 1 0 3.11 1 0 1  1.590625 18.197416         0    22.413  18.13783 16.186617         0
"34567" 0         0 1 0 3.11 1 0 1 1.6941177 18.197416         0    22.413 17.726313 14.762176         0
"34567" 1  10.02507 1 0 3.11 1 0 1       1.6 18.197416         0    22.413 17.200623 15.457044         0
"34567" 0         0 1 0 3.11 1 0 1 1.7105263 18.197416         0    22.413  15.38697   14.4257         0
"34567" 1         0 1 0 3.11 1 0 1     1.625 22.349113         0    22.413 16.423582    16.026         0
"34567" 0         0 1 0 3.11 1 0 1  1.704762 22.349113         0    22.413 17.001154    16.026         0
"34567" 0         0 1 0 3.11 1 0 1 1.7636364 22.349113         0    22.413 16.423582 14.206134         0
"45678" 0         0 1 1    3 0 1 0      2.87 28.165264  39.48592  19.55431  16.76493 12.146356         0
"45678" 0         0 1 1    3 0 1 0     2.785 28.165264  39.48592  19.55431  16.76493 12.146356         0
"45678" 0         0 1 1    3 0 1 0 2.8066666 28.165264  39.48592  19.55431 16.767302 12.148615         0
"45678" 0         0 1 1    3 0 0 0    2.9125  28.32238         0 14.422496  12.48692 12.064467         0
"45678" 0         0 1 1    3 0 0 0      3.13  28.32238         0 14.422496  12.48692 12.918624         0
"45678" 0         0 1 1    3 0 0 0  3.176667  28.32238         0 14.422496 12.491194  12.04612         0
"45678" 0         0 1 1    3 0 0 1  3.088571 26.686825         0 16.120188   12.6097 11.429308         0
"45678" 0         0 1 1    3 0 0 1    3.0775 26.686825         0 16.120188   12.6097 11.429308         0
"45678" 0         0 1 1    3 0 0 1 3.0944445 26.686825         0 16.120188 13.274253 11.429308         0
"45678" 0         0 1 1    3 0 0 1      3.06  28.84499  35.56893 14.666724 12.066757 13.550338         0
"45678" 0         0 1 1    3 0 0 1  2.972727  28.84499  35.56893 14.666724 12.066757 13.550338         0
"45678" 0         0 1 1    3 0 0 1  2.916667  28.84499  35.56893 14.666724 12.069046 13.550338         0
"45678" 0         0 1 1    3 0 0 1  2.730769  28.86301        30 14.666724 12.164404  19.52025         0
"45678" 1 12.053924 1 1    3 0 0 1 2.5357144  28.86301        30 14.666724 12.164404         0         0
"45678" 0         0 1 1    3 0 0 1 2.3666666  28.86301        30 14.666724         0         0         0
"56789" 0         0 1 0 3.88 0 0 0      3.43  42.01813 36.840317   11.6545         0  19.10925         0
"56789" 0         0 1 0 3.88 0 0 0     3.295  42.01813 36.840317   11.6545         0  19.10925         0
"56789" 0         0 1 0 3.88 0 0 0  3.446667  42.01813 36.840317   11.6545         0 19.111076         0
"56789" 0         0 1 0 3.88 0 0 1    3.1925  46.74969 31.072325         0         0 19.566505         0
"56789" 1         0 1 0 3.88 0 0 1     2.554  46.74969 31.072325         0         0 19.566505         0
"67890" 0         0 1 1 3.46 0 0 0      2.96   35.1104        10  7.937005 24.139236         0         0
"67890" 0         0 1 1 3.46 0 0 0     2.645   35.1104        10  7.937005  9.337017         0         0
"67890" 0         0 1 1 3.46 0 0 0 2.3133333   35.1104        10  7.937005  9.344658         0         0
"67890" 1 18.703476 1 1 3.46 0 0 0     1.735 35.787067        10  7.937005  20.18986         0         0
"67890" 0         0 1 1 3.46 0 0 0     1.688 35.787067        10  7.937005 20.553696         0         0
"67890" 0         0 1 1 3.46 0 0 0 1.4066666 35.787067        10  7.937005 20.554485         0         0
"67890" 0         0 1 1 3.46 0 0 1 1.6485714  35.56893         0  12.59921  7.889095         0         0
"67890" 0         0 1 1 3.46 0 0 1     1.875  35.56893         0  12.59921         0         0         0
"67890" 0         0 1 1 3.46 0 0 1 2.0366666  35.56893         0  12.59921         0         0         0
"67890" 0         0 1 1 3.46 0 0 0     1.833 37.977135  7.937005         0  13.09205 13.550338         0
"67890" 0         0 1 1 3.46 0 0 0  1.939091 37.977135  7.937005         0  13.09205 13.550338         0
"67890" 0         0 1 1 3.46 0 0 0 1.9633334 37.977135  7.937005         0 13.095937 13.550338         0
"67890" 0         0 1 1 3.46 0 0 0  2.043077 37.977135  7.937005         0 13.661972         0         0
"67890" 0         0 1 1 3.46 0 0 0      2.04  37.84354  12.59921         0 17.005766  13.55941         0
"67890" 0         0 1 1 3.46 0 0 0     2.144  37.84354  12.59921         0 16.362804  14.75146         0
"67890" 0         0 1 1 3.46 0 0 0   2.19125  37.84354  12.59921         0 16.606897 13.062813         0
"78901" 0         0 1 0 3.66 0 0 0      3.46  39.44162  32.39612  14.49901 10.409656 11.365154  9.333192
"78901" 0         0 1 0 3.66 0 0 0     3.155  39.44162  32.39612  14.49901 10.409656 11.365154  9.333192
"78901" 0         0 1 0 3.66 0 0 0 3.2133334  39.44162  32.39612  14.49901 10.409656 11.367735  9.337017
"78901" 0         0 1 0 3.66 0 0 0      3.41  39.44162  32.39612  14.49901         0         0         0
"78901" 0         0 1 0 3.66 0 0 1     3.416  41.41964 32.075344 11.049365         0         0         0
"78901" 0         0 1 0 3.66 0 0 1  3.368333  41.41964 32.075344 11.049365         0         0         0
"78901" 1         0 1 0 3.66 0 0 1  2.887143  41.41964 32.075344 11.049365         0         0         0
"78901" 0         0 1 0 3.66 0 0 1    2.9175  48.89537  69.58943 11.049365         0         0         0
"78901" 0         0 1 0 3.66 0 0 1  2.965556  48.89537  69.58943 11.049365         0         0         0
"78901" 0         0 1 0 3.66 0 0 1     3.004  48.89537  69.58943 11.049365         0         0         0
"78901" 0         0 1 0 3.66 0 0 1  3.030909  48.89537  69.58943 11.049365         0         0         0
"78901" 0         0 1 0 3.66 0 1 1  3.055833  48.89537  69.58943 11.049365         0         0         0
"78901" 0         0 1 0 3.66 0 1 1 3.1015384  48.89537  69.58943 11.049365         0         0         0
"78901" 0         0 1 0 3.66 0 1 1  3.144286  48.89537  69.58943 11.049365         0         0         0
"78901" 0         0 1 0 3.66 0 1 1     3.188  48.89537  69.58943 11.049365         0         0         0
"89012" 0         0 0 0    4 0 0 0      3.76  50.49286 35.982243  5.593445 16.090631         0         0
"89012" 0         0 0 0    4 0 0 0      3.88  50.49286 35.982243  5.593445 16.090631         0         0
"89012" 0         0 0 0    4 0 0 0      3.92  50.49286 35.982243  5.593445 16.091919         0         0
"89012" 0         0 0 0    4 0 0 0      3.83  50.49286 35.982243  5.593445  12.59921         0         0
"89012" 0         0 0 0    4 0 0 0     3.824  50.49286 35.982243  5.593445  12.59921         0         0
"89012" 1         0 0 0    4 0 0 0  3.186667  50.49286 35.982243  5.593445  12.59921         0         0
"89012" 0         0 0 0    4 0 0 1 3.2857144  50.49286 35.982243  5.593445  12.59921         0         0
"89012" 0         0 0 0    4 0 0 1   3.36375  50.49286 35.982243  5.593445  12.59921         0         0
end