BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
haoduonge
Quartz | Level 8

Hi all,

I posted this question under 'SAS Text and Content Analytics' but suggested it more relevant under here.

I have multiple time varying covariates and unfortunately their time intervals (start, stop) are different, sI split time (start, stop) of one variable into interval (T1, T2) that can be matched/merged with other variables. I run the analyses using data before (table 1) and after splitting time (table 2) and hope to get the same results but I don't.

*Before time split - table 1; HR=0.587(0.074-4.673)

proc phreg data=TABLE1;class treatment (ref=first);

model (start, stop)*outcome(0)=treatment / TIES = EFRON RL;run;

*After time split - table 2; HR=0.378(0.089-1.60)

proc phreg data=TABLE2;class treatment (ref=first);

model (start, stop)*outcome(0)=treatment/ TIES = EFRON RL;run;

 

I really appreciate if any could have explanations and/or how to adjust it?

Thank you!

 

Table 1

IDstartstoptreatmentoutcome
100.000100
10.00012.21810
200.000100
30.00012.77910
302.10500
405.09200
45.0926.4710
503.53200
53.5326.49410
603.60300
63.6036.4710
702.38201
800.96901
900.000100
90.00011.1810
1002.64200
1101.25400
1205.0700
1306.49400
1402.66100
1504.27900
1603.67101
1704.6600
174.666.4810
1806.48900
1902.66900
2004.72800
204.7286.48610
2106.4700
2202.4500
2306.49400
2400.05200
240.0521.4110
2500.000100
250.00011.72510
2606.01800
2703.61700
273.6176.45310
2800.000100
280.00013.90710
2903.04700
3006.49700
3101.98200
3200.000100
320.00011.39910
3300.62100
3402.57900
3506.44800
3605.2400
3704.22700
3801.11401
3904.28501
4001.6101
4103.84401
4202.52201
4301.76901
4403.4801
4500.000100
450.00011.66711
4600.000100
460.00011.89510

Table 2

IDstartstopoutcometreatmentT1T2
100.00010001
10.000110101
1120112
122.2180122.218
200.00010001
20.000110101
2120112
222.7790122.779
3010001
3120012
322.1050022.105
4010001
4120012
4230023
4340034
4450045
455.0920056
45.09260156
466.470166.47
5010001
5120012
5230023
533.5320034
53.53240134
5450145
5560156
566.4940166.494
6010001
6120012
6230023
633.6030034
63.60340134
6450145
6560156
666.470166.47
7011001
7121012
722.3821022.382
800.9691000.969
900.00010001
90.000110101
911.180111.18
10010001
10120012
1022.6420022.642
11010001
1111.2540011.254
12010001
12120012
12230023
12340034
12450045
1255.070055.07
13010001
13120012
13230023
13340034
13450045
13560056
1366.4940066.494
14010001
14120012
1422.6610022.661
15010001
15120012
15230023
15340034
1544.2790044.279
16011001
16121012
16231023
1633.6711033.671
17010001
17120012
17230023
17340034
1744.660045
174.6650145
17560156
1766.480166.48
18010001
18120012
18230023
18340034
18450045
18560056
1866.4890066.489
19010001
19120012
1922.6690022.669
20010001
20120012
20230023
20340034
2044.7280045
204.72850145
20560156
2066.4860166.486
21010001
21120012
21230023
21340034
21450045
21560056
2166.470066.47
22010001
22120012
2222.450022.45
23010001
23120012
23230023
23340034
23450045
23560056
2366.4940066.494
2400.0520001
240.05210101
2411.410111.41
2500.00010001
250.000110101
2511.7250111.725
26010001
26120012
27230023
27340034
27450045
27560056
2766.0180066.018
27010001
27120012
27230023
2733.6170034
273.61740134
27450145
27560156
2766.4530166.453
2800.00010001
280.000110101
28120112
28230123
2833.9070133.907
29010001
29120012
29230023
2933.0470033.047
30010001
30120012
30230023
30340034
30450045
30560056
3066.4970066.497
31010001
3111.9820011.982
3200.00010001
320.000110101
3211.3990111.399
3300.6210000.621
34010001
34120012
3422.5790022.579
35010001
35120012
35230023
35340034
35450045
35560056
3566.4480066.448
36010001
36120012
36230023
36340034
36450045
3655.240055.24
37010001
37120012
37230023
37340034
3744.2270044.227
38011001
3811.1141011.114
39011001
39121012
39231023
39341034
3944.2851044.285
40011001
4011.611011.61
41011001
41121012
41231023
4133.8441033.844
42011001
42121012
4222.5221022.522
43011001
4311.7691011.769
44011001
44121012
44231023
4433.481033.48
4500.00010001
450.000111101
4511.6671111.667
4600.00010001
460.000110101
4611.8950111.895
1 ACCEPTED SOLUTION

Accepted Solutions
FreelanceReinh
Jade | Level 19

Hi @haoduonge,

 

Thanks for posting extended sample data and the corresponding PROC PHREG results (and code) -- in the appropriate forum for this question.

 

The reason for the difference in hazard ratios is that you set variable outcome to 1 in many of the newly introduced observations of table 2. The documentation Counting Process Style of Input says (about the start/stop times):

The subject remains at risk during the interval (t1, t2], and an event might occur at t2.

So, for example ID 7 has an event at time 2.382 according to table 1, but three events (at times 1, 2 and 2.382) according to table 2. In total, you introduced 21 additional events, most of them in observations with treatment 0 -- thus making treatment 1 look much better (smaller hazard ratio).

 

With a modified version of TABLE2, named TABLE2a, I get identical estimates (incl. HR) as with TABLE1:

data table2a;
set table2;
by id;
if ~last.id & outcome=1 then outcome=0;
run;

Of course, you need to decide which version, if any, appropriately reflects the event times in your study.

 

(I'm going to call "PROC SLEEP" now as it's after midnight in my CEST time zone. Will be back on Saturday.)

View solution in original post

2 REPLIES 2
FreelanceReinh
Jade | Level 19

Hi @haoduonge,

 

Thanks for posting extended sample data and the corresponding PROC PHREG results (and code) -- in the appropriate forum for this question.

 

The reason for the difference in hazard ratios is that you set variable outcome to 1 in many of the newly introduced observations of table 2. The documentation Counting Process Style of Input says (about the start/stop times):

The subject remains at risk during the interval (t1, t2], and an event might occur at t2.

So, for example ID 7 has an event at time 2.382 according to table 1, but three events (at times 1, 2 and 2.382) according to table 2. In total, you introduced 21 additional events, most of them in observations with treatment 0 -- thus making treatment 1 look much better (smaller hazard ratio).

 

With a modified version of TABLE2, named TABLE2a, I get identical estimates (incl. HR) as with TABLE1:

data table2a;
set table2;
by id;
if ~last.id & outcome=1 then outcome=0;
run;

Of course, you need to decide which version, if any, appropriately reflects the event times in your study.

 

(I'm going to call "PROC SLEEP" now as it's after midnight in my CEST time zone. Will be back on Saturday.)

haoduonge
Quartz | Level 8

That is it!

I guess it is too late to say good night as you are about to wake up.

Thank you so much!

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 910 views
  • 0 likes
  • 2 in conversation