Can you replicate your code using the sashelp.heart data set (or one from PROC PHREG documentation) and then we can test and see if we have the same issues.?
1. Why I have only one ref group in my plot?
Show your SGPLOT code, perhaps you made a mistake there.
2. after I add covariates=data2, why it generates millions of data?
How many observations were in your covariates data? Covariates is essentially another data set that will get scored based on the model fitted. I believe you should get the same number of records as the input data set but can't recall exactly.
@Claire_panda wrote:
Hi, I tried to generate a cumulative risk plot in Proc phreg, proc phreg data=data1 ; title "Overall Survival By..."; class age_grp/ ref=first; model XYZ*died(0)=co_variate1 age_grp; baseline cumhaz=_all_ / group=age_grp; hazardratio age_grp / diff=ref cl=both; run; Then I used proc sgplot to generate the cumhaz plot, BUT, it only have my reference group in the plot. The "only ref group shown" issue also happened when I used: proc phreg data=data1 / plots(overlay)=cumhaz; I tied to add covariates in Baseline statement, baseline covariates=data2 cumhaz=_all_ / group=age_grp; But it ended up with generating millions of data and I have to quit the progress every time since it's too huge to calculate. According to the user's guide CUMHAZ plots the estimated cumulative hazard function for each set of covariates in the COVARIATES= data set in the BASELINE statement. If the COVARIATES= data set is not specified, the estimated cumulative hazard function is plotted for the reference set of covariates consisting of reference levels for the CLASS variables and average values for the continuous variables.
It would be great if someone can help me with the questions below: 1. Why I have only one ref group in my plot? 2. after I add covariates=data2, why it generates millions of data? Or, my final goal is just to generate cumulative risk plot with 4 curves (since 4 age groups) classed by the age_grp in one plot . Thank you so much!
... View more