BookmarkSubscribeRSS Feed
Kels123
Quartz | Level 8

I have a curve I am printing using proc lifetest:

 

proc lifetest data=CLEAN.databasesurv3 plots=s outsurv=clean.SurvEst_AIDSSTAGE conftype=linear;

time time * EVENT_ANYDEATH(0);

strata disease_categ_dx2_num ;

run;

 

The problem is I need to do a few key modifications things: 

1.) Modify the y-axis to start at 0.5

2.) Add number of individuals at risk (for each stratum if possible)

3.) Add the log-rank p-value in a legend (not as dire as the other two things)

 

 

I have tried modifying the proc lifetest code, and also using proc gplot, proc template, and macros like %newsurv, but nothing has gotten close to what I need and I think now I am just thoroughly confused. I know this is a common problem, and I could really use a solution that doesn't require an in-depth expertise in programming. It seems like I should use "layout overlay", but that seems to be part of proc template, which is very intimidating at this point. This is the closest I have gotten so far, using this code:

 

proc lifetest data=CLEAN.databasesurv3 method=km atrisk

    plots=(S(test nocensor atrisk=0 to 3000 by 500)) method=km MAXTIME= 3000 intervals=(0 to 3000 by 500);

    time time*EVENT_ANYDEATH(0);

                strata disease_categ_dx2_num / adjust=sidak test=logrank;

                /*format chemo_weeks_cat chemo_weeks_cat.;*/

run;

 

I was thinking maybe I could combine it with something like this? Thank you in advance.

 

%ProvideSurvivalMacros

%let yOptions = label="Survival Probability"

linearopts=(viewmin=0.6 viewmax=1

/*tickvaluelist=(0 .2 .4 .6 .8 1.0))*/;

%CompileSurvivalTemplates

 

Any assistance would be greatly appreciated. If I DO need to use proc template or a macro, it would be really helpful to have a better explanation of how these work together with proc lifetest than the explanations I have found previously online. Thank you in advance. 

 

 

 

 

2 REPLIES 2
WarrenKuhfeld
Rhodochrosite | Level 12

https://support.sas.com/documentation/onlinedoc/stat/142/kaplan.pdf

 

Have you looked at this chapter?  I think it provides clear explanations of what you want.  I wrote it so I would really like to know what parts aren't clear. You can contact me with questions, I am saswfk I am at sas and you know the rest.  The macros are much clearer than going in and modifying full templates and the examples address your questions.

 

WarrenKuhfeld
Rhodochrosite | Level 12

It looks to me like you had it figured out.  This code works for me.  What else do you need?

 


* One time set up to get the macros;
data _null_;
   %let url = //support.sas.com/documentation/onlinedoc/stat/ex_code/142;
   infile "http:&url/templft.html" device=url;

   file 'macros.tmp';
   retain pre 0;
   input;
   _infile_ = tranwrd(_infile_, '&', '&');
   _infile_ = tranwrd(_infile_, '&lt;' , '<');
   if index(_infile_, '</pre>') then pre = 0;
   if pre then put _infile_;
   if index(_infile_, '<pre>')  then pre = 1;
run;

%inc 'macros.tmp' / nosource;


* Modify the template;
%ProvideSurvivalMacros
%let yOptions = label="Survival Probability"
                linearopts=(viewmin=0.5 viewmax=1);
%CompileSurvivalTemplates

* Analysis;
ods graphics on;
proc lifetest data=sashelp.bmt method=km atrisk
     plots=(S(test nocensor atrisk=0 to 3000 by 500)) 
            method=km MAXTIME= 3000 intervals=(0 to 3000 by 500);
    time t*status(0);
    strata group / adjust=sidak test=logrank;
run;

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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
  • 2 replies
  • 1328 views
  • 1 like
  • 2 in conversation