BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
yechen
Calcite | Level 5

Dear all, 

When I used proc lifetest to plot Kaplan-Meier curve and found the curve only showed between 0.25 and 0.75. 

Besides, the Y-Axis automatically becomes "CIF" rather than "survival probability". (as the followed screenshot)

The code I test is very basic as followed:

PROC LIFETEST DATA=MYEL METHOD=KM;
TIME DUR*STATUS(0);
RUN;

 

I tried using other codes and dataset which performed normally before. I also tried copying the code and data from SAS tutorial directly. I even tried uninstalling and reinstalling the SAS program.  But it continued to show this way.

If everyone used to face this problem, please let me know how to solve it. Thank you.

 

yechen_0-1665206266734.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

Interestingly when I run the code you posted it shows the full axis. 

I wonder if you modified the options earlier?

Here is how you can customize the axis:

 

filename demo temp;

data _null_;
   %let url = //support.sas.com/documentation/onlinedoc/stat/ex_code/142;
   infile "http:&url/templft.html" device=url;

   file demo;
   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 demo / nosource;

%ProvideSurvivalMacros;

%let yOptions = label="My Custom Label"
                linearopts=(viewmin=0 viewmax=1
                            tickvaluelist=(0 .1 .25 .5 .75 .9 1));

%CompileSurvivalTemplates;

*Kaplain-Merier Estimation;
PROC LIFETEST DATA=MYEL METHOD=KM plots=survival(nocensor );
	TIME DUR*STATUS(0);
RUN;

The first part downloads the macros from SAS that allow for easy customization and then you can set the options list. 

View solution in original post

5 REPLIES 5
ballardw
Super User

What happens if you add this to your Proc Lifetest statement:

plots=survival(nocensor )

There is an entire section in the documentation on modifying and controlling these plots taking maybe 40 or 50 pages. Quite often there will be multiple ways to accomplish something.

 

You can start here for more ideas:

https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.4/statug/statug_kaplan_toc.htm

 

Note: without your data we can't test code.

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.

yechen
Calcite | Level 5

Thank you for the repley. I used the code "plots=survival(nocensor )" you suggested. But the graph still only showed between 0.25 and 0.75. The followed are the graph and the codes I tested. I've tried some steps in the documents to force the graph show top limit to 1.0 but it doesn't work.

 

yechen_0-1665244617923.png

 

DATA MYEL;
	INPUT DUR STATUS TREAT RENAL;
	DATALINES;
8  1   1   1
180  1   2   0
632  1   2   0
852  0   1   0
52  1   1   1
2240  0   2   0
220  1   1   0
63  1   1   1
195  1   2   0
76  1   2   0
70  1   2   0
8  1   1   0
13  1   2   1
1990  0   2   0
1976  0   1   0
18  1   2   1
700  1   2   0
1296  0   1   0
1460  0   1   0
210  1   2   0
63  1   1   1
1328  0   1   0
1296  1   2   0
365  0   1   0
23  1   2   1
     ;
RUN;
*Kaplain-Merier Estimation;
PROC LIFETEST DATA=MYEL METHOD=KM plots=survival(nocensor );
	TIME DUR*STATUS(0);
RUN;

 

Reeza
Super User

Interestingly when I run the code you posted it shows the full axis. 

I wonder if you modified the options earlier?

Here is how you can customize the axis:

 

filename demo temp;

data _null_;
   %let url = //support.sas.com/documentation/onlinedoc/stat/ex_code/142;
   infile "http:&url/templft.html" device=url;

   file demo;
   retain pre 0;
   input;
   _infile_ = tranwrd(_infile_, '&amp;', '&');
   _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 demo / nosource;

%ProvideSurvivalMacros;

%let yOptions = label="My Custom Label"
                linearopts=(viewmin=0 viewmax=1
                            tickvaluelist=(0 .1 .25 .5 .75 .9 1));

%CompileSurvivalTemplates;

*Kaplain-Merier Estimation;
PROC LIFETEST DATA=MYEL METHOD=KM plots=survival(nocensor );
	TIME DUR*STATUS(0);
RUN;

The first part downloads the macros from SAS that allow for easy customization and then you can set the options list. 

yechen
Calcite | Level 5

Thank you. It works!!! I appreciate it.

I am not aware that I changed any options or setting.

But maybe I changed unintentionally when I tried coding before.

WarrenKuhfeld
Rhodochrosite | Level 12
Be sure to delete the modified templates when you are done to avoid having problems next time. The documentation shows you how.

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!

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