<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Create a Kaplan-Meier cumulative incidence curve by strata in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Create-a-Kaplan-Meier-cumulative-incidence-curve-by-strata/m-p/892952#M352718</link>
    <description>Yes, last time observed is lastage. What does the y-axis "Failure probability" mean?</description>
    <pubDate>Wed, 06 Sep 2023 15:03:14 GMT</pubDate>
    <dc:creator>ANKH1</dc:creator>
    <dc:date>2023-09-06T15:03:14Z</dc:date>
    <item>
      <title>Create a Kaplan-Meier cumulative incidence curve by strata</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-Kaplan-Meier-cumulative-incidence-curve-by-strata/m-p/892803#M352654</link>
      <description>&lt;P&gt;Hi, this is my first time attempting to run a KM curve in SAS. I apologize in advance if my questions are not well structured. We need to produce a KM curve for cumulative incidence from age at which subjects started treatment(Age_trt) to when they presented their first respiratory emergency (Event_age). This needs to be stratified by group1 and group2.&lt;/P&gt;&lt;P&gt;This is the raw dataset:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;data have;
input ID Lastage group1	group2 Age_trt Event_age; 
datalines;
1	12	0	1	2	4
2	13	0	1	4	6
3	11	1	0	3	7
4	12	1	0	2	.
5	14	0	1	2	.
6	12	1	0	7	9
7	11	1	0	1	6
8	14	0	1	3	.
9	13	1	0	3	.
10	13	0	1	5	8
;
run;

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;From what I gathered a "censored" variable is needed to run proc lifetest.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;data for_test;
input ID Lastage group1	group2 Age_trt Event_age Censoring_status; 
datalines;
1	12	0	1	4	1
2	13	0	1	6	1
3	11	1	0	7	1
4	12	1	0	.	0
5	14	0	1	.	0
6	12	1	0	9	1
7	11	1	0	6	1
8	14	0	1	.	0
9	13	1	0	.	0
10	13	0	1	8	1
;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;I am not sure how the group variable should be transformed and if so how. I am not sure how the code will need to be adapted to show the cumulative incidence instead of the more common survival analysis?&lt;/P&gt;</description>
      <pubDate>Tue, 05 Sep 2023 21:45:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-Kaplan-Meier-cumulative-incidence-curve-by-strata/m-p/892803#M352654</guid>
      <dc:creator>ANKH1</dc:creator>
      <dc:date>2023-09-05T21:45:33Z</dc:date>
    </item>
    <item>
      <title>Re: Create a Kaplan-Meier cumulative incidence curve by strata</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-Kaplan-Meier-cumulative-incidence-curve-by-strata/m-p/892816#M352656</link>
      <description>&lt;P&gt;Rough idea to get you started.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input ID Lastage group1 group2 Age_trt Event_age; 
datalines;
1   12  0   1   2   4
2   13  0   1   4   6
3   11  1   0   3   7
4   12  1   0   2   .
5   14  0   1   2   .
6   12  1   0   7   9
7   11  1   0   1   6
8   14  0   1   3   .
9   13  1   0   3   .
10  13  0   1   5   8
;
run;

data sample;
set have;
time2event = coalesce(event_age, lastage) - age_trt;
censor = missing(event_age);
run;

proc format;
value group_label
0 = 'Group 2'
1 = 'Group 1';
run;

proc lifetest data=sample plots=survival(f);
strata group1;
format group1 group_label;
time time2event*censor(1);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 05 Sep 2023 22:18:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-Kaplan-Meier-cumulative-incidence-curve-by-strata/m-p/892816#M352656</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2023-09-05T22:18:55Z</dc:date>
    </item>
    <item>
      <title>Re: Create a Kaplan-Meier cumulative incidence curve by strata</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-Kaplan-Meier-cumulative-incidence-curve-by-strata/m-p/892823#M352659</link>
      <description>&lt;P&gt;Thank you! For the group variables, basically we need only a variable called group to be able to stratify? And Lastage variable is needed to limit what? Sorry, I am having trouble interpreting the the graph and the use of the variable Lastage. Could you please show the figure you got and kindly explain the interpretation? It means appearance of the first event? Thank you in advance.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Sep 2023 23:52:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-Kaplan-Meier-cumulative-incidence-curve-by-strata/m-p/892823#M352659</guid>
      <dc:creator>ANKH1</dc:creator>
      <dc:date>2023-09-05T23:52:02Z</dc:date>
    </item>
    <item>
      <title>Re: Create a Kaplan-Meier cumulative incidence curve by strata</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-Kaplan-Meier-cumulative-incidence-curve-by-strata/m-p/892948#M352714</link>
      <description>&lt;P&gt;&amp;nbsp;This is the figure:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KM.jpg" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/87667i8380500DFFE90D2E/image-size/large?v=v2&amp;amp;px=999" role="button" title="KM.jpg" alt="KM.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Sep 2023 14:33:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-Kaplan-Meier-cumulative-incidence-curve-by-strata/m-p/892948#M352714</guid>
      <dc:creator>ANKH1</dc:creator>
      <dc:date>2023-09-06T14:33:15Z</dc:date>
    </item>
    <item>
      <title>Re: Create a Kaplan-Meier cumulative incidence curve by strata</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-Kaplan-Meier-cumulative-incidence-curve-by-strata/m-p/892951#M352717</link>
      <description>&lt;P&gt;First step is to create the time variable - specifically the time to event. Which I'm assuming is measured as the event_age - age_start treatment. However, for censored data you do not have an event, so to calculate time to event you use the last time observed, which I'm assuming is the lastAge.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Sep 2023 15:00:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-Kaplan-Meier-cumulative-incidence-curve-by-strata/m-p/892951#M352717</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2023-09-06T15:00:30Z</dc:date>
    </item>
    <item>
      <title>Re: Create a Kaplan-Meier cumulative incidence curve by strata</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-Kaplan-Meier-cumulative-incidence-curve-by-strata/m-p/892952#M352718</link>
      <description>Yes, last time observed is lastage. What does the y-axis "Failure probability" mean?</description>
      <pubDate>Wed, 06 Sep 2023 15:03:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-Kaplan-Meier-cumulative-incidence-curve-by-strata/m-p/892952#M352718</guid>
      <dc:creator>ANKH1</dc:creator>
      <dc:date>2023-09-06T15:03:14Z</dc:date>
    </item>
    <item>
      <title>Re: Create a Kaplan-Meier cumulative incidence curve by strata</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-Kaplan-Meier-cumulative-incidence-curve-by-strata/m-p/892955#M352720</link>
      <description>That is the percentage of people hitting who've experienced the event.</description>
      <pubDate>Wed, 06 Sep 2023 15:05:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-Kaplan-Meier-cumulative-incidence-curve-by-strata/m-p/892955#M352720</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2023-09-06T15:05:36Z</dc:date>
    </item>
    <item>
      <title>Re: Create a Kaplan-Meier cumulative incidence curve by strata</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-Kaplan-Meier-cumulative-incidence-curve-by-strata/m-p/892956#M352721</link>
      <description>&lt;P&gt;&amp;nbsp;Great! Thanks for explaining this. Just to confirm, for my knowledge, it is best to have a variable called group so this can be used to stratified right?&lt;/P&gt;</description>
      <pubDate>Wed, 06 Sep 2023 15:08:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-Kaplan-Meier-cumulative-incidence-curve-by-strata/m-p/892956#M352721</guid>
      <dc:creator>ANKH1</dc:creator>
      <dc:date>2023-09-06T15:08:12Z</dc:date>
    </item>
    <item>
      <title>Re: Create a Kaplan-Meier cumulative incidence curve by strata</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-Kaplan-Meier-cumulative-incidence-curve-by-strata/m-p/892960#M352725</link>
      <description>Not necessarily, that was part of your question.</description>
      <pubDate>Wed, 06 Sep 2023 15:13:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-Kaplan-Meier-cumulative-incidence-curve-by-strata/m-p/892960#M352725</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2023-09-06T15:13:08Z</dc:date>
    </item>
    <item>
      <title>Re: Create a Kaplan-Meier cumulative incidence curve by strata</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-Kaplan-Meier-cumulative-incidence-curve-by-strata/m-p/892962#M352727</link>
      <description>&lt;P&gt;Ok, how will the proc lifetest code change if you have a group variable and you want to stratify by this variable? Let's say the values are 1 and 2 for the group variable.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Sep 2023 15:17:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-Kaplan-Meier-cumulative-incidence-curve-by-strata/m-p/892962#M352727</guid>
      <dc:creator>ANKH1</dc:creator>
      <dc:date>2023-09-06T15:17:52Z</dc:date>
    </item>
    <item>
      <title>Re: Create a Kaplan-Meier cumulative incidence curve by strata</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-Kaplan-Meier-cumulative-incidence-curve-by-strata/m-p/892963#M352728</link>
      <description>Try it &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;</description>
      <pubDate>Wed, 06 Sep 2023 15:18:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-Kaplan-Meier-cumulative-incidence-curve-by-strata/m-p/892963#M352728</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2023-09-06T15:18:36Z</dc:date>
    </item>
    <item>
      <title>Re: Create a Kaplan-Meier cumulative incidence curve by strata</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-Kaplan-Meier-cumulative-incidence-curve-by-strata/m-p/892968#M352729</link>
      <description>&lt;P&gt;Is this correct:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;data sample;
set have;
time2event = coalesce(event_age, lastage) - age_trt;
censor = missing(event_age);
if group1=1 then group=1,
else group=2;
run;



proc lifetest data=sample plots=survival(f);
strata group;
time time2event*censor(1);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 06 Sep 2023 15:31:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-Kaplan-Meier-cumulative-incidence-curve-by-strata/m-p/892968#M352729</guid>
      <dc:creator>ANKH1</dc:creator>
      <dc:date>2023-09-06T15:31:15Z</dc:date>
    </item>
    <item>
      <title>Re: Create a Kaplan-Meier cumulative incidence curve by strata</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-Kaplan-Meier-cumulative-incidence-curve-by-strata/m-p/892969#M352730</link>
      <description>If you run that does it work? I see syntax errors at minimum.</description>
      <pubDate>Wed, 06 Sep 2023 15:32:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-Kaplan-Meier-cumulative-incidence-curve-by-strata/m-p/892969#M352730</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2023-09-06T15:32:19Z</dc:date>
    </item>
    <item>
      <title>Re: Create a Kaplan-Meier cumulative incidence curve by strata</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-Kaplan-Meier-cumulative-incidence-curve-by-strata/m-p/892976#M352732</link>
      <description>&lt;P&gt;Sorry, missed a ";"&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;data sample;
set have;
time2event = coalesce(event_age, lastage) - age_trt;
censor = missing(event_age);
if group1=1 then group=1;
else group=2;
run;

proc lifetest data=sample plots=survival(f);
strata group;
time time2event*censor(1);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 06 Sep 2023 15:47:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-Kaplan-Meier-cumulative-incidence-curve-by-strata/m-p/892976#M352732</guid>
      <dc:creator>ANKH1</dc:creator>
      <dc:date>2023-09-06T15:47:24Z</dc:date>
    </item>
    <item>
      <title>Re: Create a Kaplan-Meier cumulative incidence curve by strata</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-Kaplan-Meier-cumulative-incidence-curve-by-strata/m-p/892986#M352737</link>
      <description>&lt;P&gt;I have another question, if we were to create a more elaborate figure using proc sgplot, we need a dataset from proc lifetest, correct?&lt;/P&gt;&lt;P&gt;I tried using this but it didn't work:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;ods output survivalplot=sp;
proc lifetest data=sample plots=survival(f);
strata group;
time time2event*censor(1);
run;
ods output close; &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 06 Sep 2023 16:45:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-Kaplan-Meier-cumulative-incidence-curve-by-strata/m-p/892986#M352737</guid>
      <dc:creator>ANKH1</dc:creator>
      <dc:date>2023-09-06T16:45:44Z</dc:date>
    </item>
    <item>
      <title>Re: Create a Kaplan-Meier cumulative incidence curve by strata</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-Kaplan-Meier-cumulative-incidence-curve-by-strata/m-p/892987#M352738</link>
      <description>Use ODS TRACE to see the table/graph names to ensure your ODS statement is correct. &lt;BR /&gt;&lt;BR /&gt;Also what does 'it doesn't work' mean? That could be anything from a syntax error to SAS crashing.</description>
      <pubDate>Wed, 06 Sep 2023 16:51:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-Kaplan-Meier-cumulative-incidence-curve-by-strata/m-p/892987#M352738</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2023-09-06T16:51:30Z</dc:date>
    </item>
    <item>
      <title>Re: Create a Kaplan-Meier cumulative incidence curve by strata</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-Kaplan-Meier-cumulative-incidence-curve-by-strata/m-p/892996#M352744</link>
      <description>&lt;P&gt;There was no output.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Sep 2023 17:17:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-Kaplan-Meier-cumulative-incidence-curve-by-strata/m-p/892996#M352744</guid>
      <dc:creator>ANKH1</dc:creator>
      <dc:date>2023-09-06T17:17:08Z</dc:date>
    </item>
    <item>
      <title>Re: Create a Kaplan-Meier cumulative incidence curve by strata</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-Kaplan-Meier-cumulative-incidence-curve-by-strata/m-p/892998#M352745</link>
      <description>&lt;P&gt;I used the following:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;proc lifetest data=sample plots=survival(f)
outsurv=survival_data timelist=(0 to 200 by 12) reduceout;
strata group;
time time2event*censor(1);
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I get the dataset to be use in proc sgplot but I am not sure what to put in the Y axis. The examples I've seen are with "Survival" not like the graph for cumulative incidence. I tried to use Failure but it says that the variable does not exist.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Sep 2023 17:22:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-Kaplan-Meier-cumulative-incidence-curve-by-strata/m-p/892998#M352745</guid>
      <dc:creator>ANKH1</dc:creator>
      <dc:date>2023-09-06T17:22:13Z</dc:date>
    </item>
    <item>
      <title>Re: Create a Kaplan-Meier cumulative incidence curve by strata</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-Kaplan-Meier-cumulative-incidence-curve-by-strata/m-p/893000#M352746</link>
      <description>Why? What did the log say?</description>
      <pubDate>Wed, 06 Sep 2023 17:25:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-Kaplan-Meier-cumulative-incidence-curve-by-strata/m-p/893000#M352746</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2023-09-06T17:25:22Z</dc:date>
    </item>
    <item>
      <title>Re: Create a Kaplan-Meier cumulative incidence curve by strata</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-Kaplan-Meier-cumulative-incidence-curve-by-strata/m-p/893004#M352749</link>
      <description>That outputs the raw data, you'll have to re-do the calculations. You were on the right track trying to get the plot data instead, but you have the wrong graph name - it's a failure plot not survival plot. Use ODS TRACE, check the log to get the correct ODS name.&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://blogs.sas.com/content/iml/2017/01/09/ods-output-any-statistic.html" target="_blank"&gt;https://blogs.sas.com/content/iml/2017/01/09/ods-output-any-statistic.html&lt;/A&gt;</description>
      <pubDate>Wed, 06 Sep 2023 17:38:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-Kaplan-Meier-cumulative-incidence-curve-by-strata/m-p/893004#M352749</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2023-09-06T17:38:51Z</dc:date>
    </item>
  </channel>
</rss>

