04-20-2017 09:07 AM
I am working on survival data with incidence of cancer and some food consumption data in quartiles.
Exposition : quartile of sugared food
Confusion factor : age, BMI, sex.
Outcome : cancer
I would like to draw a curve of cumulative hazard rate function (for example with Nelson Aalen estimator, a non parametric estimator of the cumulative hazard rate function) like this graph below : where we would see the cumulative risk of cancer in function of the 4 quartiles of food consumption.
Caption of the graph : "Nelson-Aalen curves showing the outcome of new-onset overweight depending on ultraprocessed food consumption at baseline. Adjusted for sex, age, marital status, educational status"
If someone had an idea of a beginning of script, i would be really grateful.
i am doing Cox model with this type of script :
proc phreg data=mydata; class sexe; model survival_time*censure(1)=sexe age IMC; strata quartile_ultraprocessed ; run;
Thanks in advance, have a nice day,
04-20-2017 04:49 PM
Have you tried adding the PLOTSooption to your PROC statement?
You'll want tthe 'statistical' style to get the curves in a similar format but you'll have to manually add the data at the top. If you can post it at the bottom of the graph that could be more easily incorporated.
04-26-2017 10:30 AM
You can get the cumulative hazard (Nelson Aalen) by using the baseline statement in PHREG;
As Nelson Aalen only can account for one combination of covariates at a time you will need to put all covariates into the strata statement.
Here is a simple example:
data test; do i=1 to 100; x=mod(i,2); t=rand('exponential',1); output; end; run; proc phreg data=test; model t=; strata x; baseline out=baseline cumhaz=cumhaz; run;
You can then plot the hazard by using proc gplot or sgplot.
04-27-2017 06:26 AM
thanks for your answers.
I tested your statements but I don't know why when I look at the table "baseline" created and containing "Cumulative Hazard function estimates", there are only about 2000 observations. And in my dataset of departure, I have about 100 000 observations (about 2200 events and 97 800 censored). Do you have an idea why I have this decrease ?
have a nice day,
04-27-2017 06:38 AM
the estimated cumulative hazard function only has as many jumps (its a step function) as there are uncensored events. So wiht 2200 events it should have 2200 observations.