Hi community,
I am using the ICPHREG proc to generate survival estimates with a cubic spline for the baseline survival curve. I come from a background using R functions and am struggling with the syntax for this proc.
The example in the SAS help pages creates a left interval variable and right interval variable for a data set (see below). These variables indicate when the subject entered observation (left) and when they stopped participating in the study (right). The data set, however, does not have a variable stating if the subject failed (developed AIDS) or not.
It's been a while since I've thought about left and right censoring in survival analysis but I did not think you could figure out if an event occurred simply by the time interval under which the subject is being observed. A subject can enter a study and exit a study at any time and we may not have collected any data on if the failure happened. The only exception where an inference can be made (to my recollection) is if observation time ends at the end of the study -- hence indicating that an event was not observed prior to study end date. In other words, we can assume this subject "survived."
Unfortunately, I'm not sure how this relates to the use of the left and right intervals in the hiv example. Further, I'm not sure how to map this logic onto a data set I am analyzing where the time to event is provided in addition to an indicator variable for if failure occurred. There is no time point for entering the study. Simply the duration of observation for the subject and another variable indicating if an event occured.
I've tried various combinations of coding left and right intervals based on the subjects' time to event and event data. I've used different rules for a failed subject vs. a survived subject where left censoring is set to one way for a subject that failed and a different way for a subject that survived. But none of my coding combinations get the same survival estimates that I'm achieving in R using the flexsurvreg package. They are all large underestimates of survival that can't be attributed to different methods in how the values are being estimated. This leads me to believe I must be coding the left and right variables incorrectly.
Here is the example data set and icphreg call in the SAS help pages:
data hiv;
input Left Right Stage Dose CdLow CdHigh;
if (Left=0) then Left=.;
if (Right>=26) then Right=.;
datalines;
0 16 0 0 0 1
15 26 0 0 0 1
12 26 0 0 0 1
17 26 0 0 0 1
13 26 0 0 0 1
0 24 0 0 1 0
6 26 0 1 1 0
0 15 0 1 1 0
14 26 0 1 1 0
12 26 0 1 1 0
13 26 0 1 0 1
12 26 0 1 1 0
12 26 0 1 1 0
0 18 0 1 0 1
0 14 0 1 0 1
0 17 0 1 1 0
0 15 0 1 1 0
3 26 1 0 0 1
4 26 1 0 0 1
1 11 1 0 0 1
13 19 1 0 0 1
0 6 1 0 0 1
0 11 1 1 0 0
6 26 1 1 0 0
0 6 1 1 0 0
2 12 1 1 0 0
1 17 1 1 1 0
0 14 1 1 0 0
0 25 1 1 0 1
2 11 1 1 0 0
0 14 1 1 0 0
;
proc icphreg data=hiv;
model (left, right) = cdlow / base=cubicsplines(df=3);
run;
Here is a dummy data set similar to the one I'm using in my analysis where I need to code a left and right based on whether or not an event occured (event = 1 means failed) along with the timetoevent variable:
data mock;
input timetoevent event score;
datalines;
8 1 9
1 1 4
5 0 8
9 0 4
3 1 9
6 0 3
2 1 8
4 1 7
8 0 2
9 0 3
;
In the Syntax => MODEL Statement section of the PROC ICPHREG documentation is a table that explains how to code the lower and upper values for various types of censoring and no censoring. So, in this table it shows how to code left, right and interval censoring and if lower=upper this is an uncensored observation (an "event" observation).
In the Syntax => MODEL Statement section of the PROC ICPHREG documentation is a table that explains how to code the lower and upper values for various types of censoring and no censoring. So, in this table it shows how to code left, right and interval censoring and if lower=upper this is an uncensored observation (an "event" observation).
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
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.