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

I am trying to fit a marginal fine gray model using proc phreg. Following is my code. Suppose times are observed times, causes could be either 0,1 or 2 with 1 being the main event, Z is a binary covariate and cluster is a clustering covariate.

 

 

proc phreg data=mydata;
     model times * causes(0) = Z/eventcode=1;
     id cluster;
run;

 

If I delete

id cluster;

and run the model again then it produces the exact same result. How can I get the correct result after accounting for clustering covariate? I understand that the parameter estimates are same no matter which model is used, however the standard errors should be different.

1 ACCEPTED SOLUTION

Accepted Solutions
OsoGris
SAS Employee

You need the COVSANDWICH(AGGREGATE) option on the PROC PHREG statement. This can be abbreviated as COVS(AGGREGATE).   This will provide for robust standard errors for your clustering variable in the ID statement.

View solution in original post

4 REPLIES 4
ballardw
Super User

"Not working" is awful vague.

Are there errors in the log?: Post the code and log in a code box opened with the "<>" to maintain formatting of error messages.

No output? Post any log in a code box.

Unexpected output? Provide input data in the form of data step code pasted into a code box, the actual results and the expected results. Instructions here: https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat... will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the "</>" icon or attached as text to show exactly what you have and that we can test code against.

 

The ID statement only provides for variable(s) to be included in output to identify observations from the input set. So I would not expect it change the output of any model. Did you mean to use Cluster as a CLASS variable and include it in the model?

 

How do you know it is "not working"? Which specific output are you examining? What value indicates "not working".

themanoj20080
Fluorite | Level 6
There are no errors in the log. I know this is not working because when I look at the result for "Analysis of Maximum Likelihood Estimates" they are exactly the same. No I don't want to use cluster variable in the model. I want to use it in the ID statement.
OsoGris
SAS Employee

You need the COVSANDWICH(AGGREGATE) option on the PROC PHREG statement. This can be abbreviated as COVS(AGGREGATE).   This will provide for robust standard errors for your clustering variable in the ID statement.

themanoj20080
Fluorite | Level 6
Thank you very much. This is exactly what I was looking for.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 4 replies
  • 885 views
  • 1 like
  • 3 in conversation