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.
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.
"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".
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.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.