BookmarkSubscribeRSS Feed
SeaMoon_168
Obsidian | Level 7

The original code can be accessed from SAS: Analysis of Multivariate Failure Time Data

https://documentation.sas.com/doc/en/statug/15.2/statug_phreg_details45.htm#statug_phreg012597

proc phreg covs(aggregate);
   model (Tstart,Tstop)*Status(0)=Trt Age;
   baseline covariates=Pattern out=out2 cmf=_all_;
   id ID;
run;

However, if I add eventcode=1, the code does not work.

proc phreg covs(aggregate);
   model (Tstart,Tstop)*Status(0)=Trt Age/ evencode=1;
   baseline covariates=Pattern out=out2 cmf=_all_;
   id ID;
run;

Can anyone help me figure it out? Many thanks!

3 REPLIES 3
ballardw
Super User

Doesn't work 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.

 

 

Assuming of course your submitted code was EVENTCODE=1 not the EVENCODE shown in your post.

Quite often the LOG does have related information that you should share.

SeaMoon_168
Obsidian | Level 7

data is

ID TStart TStop Status Trt Age
174054 0 293 0 1 38
204001 0 219 1 2 12
204001 219 373 2 2 12
204001 373 414 0 2 12

I am sorry for the typo, It should be eventcode=1.

Actually I got some warnings. It seems cmf cannot work with Fine and Gray competing risk analysis together? So how can I write the code to generate mcf and competing risk together?

SeaMoon_168_0-1724087669487.png

 

Ksharp
Super User

1)
I think you need to change your data structure(a subject has only one obs/Time/Status) to use EVENTCODE=1.
You can " create a time-varying covariate using programming statements in proc phreg." other than this kind of data structure [TStart, TStop] .
And Here is an example:
(here 'in_hosp' is a time-varying covariate)
proc phreg covs(aggregate);
model Time*Status(0)=Trt Age in_hosp/ evencode=1;
if Time> 219 then in_hosp = 0;
else in_hosp = 1;
run;


2)
If you don't have time-varying covariates, that would be better to use this code:
(Make sure a subject has only an obs and a TIME value and a STATUS value)
proc phreg covs(aggregate);
model Time*Status(0)=Trt Age/ evencode=1;

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 3 replies
  • 278 views
  • 0 likes
  • 3 in conversation