BookmarkSubscribeRSS Feed
Claire_panda
Calcite | Level 5

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!

 

 

1 REPLY 1
Reeza
Super User

 

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!

 

 


 

SAS Innovate 2025: Call for Content

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!

Submit your idea!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 542 views
  • 0 likes
  • 2 in conversation