<?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: How to Customize SGPLOT for KM plot in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-Customize-SGPLOT-for-KM-plot/m-p/779424#M248222</link>
    <description>&lt;P&gt;All of the SAS programs are &lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/Kaplan-Meier-Survival-Plotting-Macro-NEWSURV/m-p/479747#U479747" target="_self"&gt;attached to the article&lt;/A&gt;. I believe the &lt;A href="https://communities.sas.com/kntur85557/attachments/kntur85557/library/3014/10/newsurv_web_042020.sas" target="_self"&gt;most recent version is this one.&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 09 Nov 2021 20:57:50 GMT</pubDate>
    <dc:creator>ChrisHemedinger</dc:creator>
    <dc:date>2021-11-09T20:57:50Z</dc:date>
    <item>
      <title>How to Customize SGPLOT for KM plot</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-Customize-SGPLOT-for-KM-plot/m-p/779403#M248210</link>
      <description>&lt;P&gt;I am learning SGPLOT to output the KM plots recently, I have some questions how to customize the Kaplan plot output. I tried&amp;nbsp; to achieve it using the sas documentation, but I am not able to achieve it. I have the questions mentioned in the image. Can you guys please help me to learn the things, also please direct any good references. Thank you in Advance&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SASuserlot_0-1636486842286.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/65530iC6034BB84B1D0C10/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SASuserlot_0-1636486842286.png" alt="SASuserlot_0-1636486842286.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
**Dummy data**;

data adtte;
   length paramcd $8 param $100;
   paramcd = "OS";
   param = "Overall Survival";
   do trtpn = 1 to 4;
      trtp = 'Treatment ' || put(trtpn,1.);
      do subjid = 1 to 40;
         aval = 2 + ranuni(1)*24*(trtpn/4);
         cnsr = (ranuni(1)&amp;gt;0.2);
         output;
      end;
   end;
run;

proc sort data=adtte out=km00;
   by trtpn trtp;
   where paramcd = "OS";
run;
proc sql noprint;
   select   distinct strip(param) || " Probability"
   into     :ylabel
   from     km00
   ;
quit;
%let ylabel = &amp;amp;ylabel;
%put &amp;amp;=ylabel;

* creating tick marks on X-axis*;
%let values = 0 2 4 6 8 10 12 14 16 18 20 22 24;
%put &amp;amp;=values;

**format the value 0 as B/L**;
proc format;
   value timefmt
   0 = "B/L"
   other = [best.]
   ;
run;
ods html;
**lifetest**;


ods graphics on;
ods listing close; 

proc lifetest data=km00 plots=(survival(atrisk=&amp;amp;values));
   ods output survivalplot=km10;
   time aval*cnsr(1);
   strata trtpn;
run;

**complete with a format to prevent missing values from showing up as a dot.**;
proc format;
   value xatn
   . = " "
   other = [best.]
   ;
run;

data km20;
   set km10;
   if n(tatrisk) then
      xatn = atrisk;
   format xatn xatn.;
run;

****************************************************************************
Next we add the xaxistable statement. For some reason SAS has us use the 
class= option to create groups in the x-axis table (we use the group= option 
in the step and scatter statements).
*****************************************************************************;
proc sgplot data=km20;
   *--- draw the survival curves ---;
   step y=survival x=time / 
      group=stratumnum
      name="step"
      ;
   *--- draw censor indicators for censoring symbol legend purposes ---;
   scatter y=censored x=time /
      markerattrs=(symbol=circle )   
      name="censor"
      ;
   *--- draw censor indicators ---;
   scatter y=censored x=time /
      group=stratumnum 
      markerattrs=(symbol=circle)
 		;

	*--- add the sample sizes ---;
   xaxistable xatn /
      class=stratumnum
      colorgroup=stratumnum
      ;

   *--- cosmetics ---;
   yaxis
      label="&amp;amp;ylabel"
      ;
   xaxis 
      values=(&amp;amp;values) 
      valueshint
      valuesformat=timefmt.
      label="Weeks" ;

	**--Key legend--&amp;gt; Main heading--**;

   keylegend "step" /
      title="Treatment Group"
      noborder
      linelength=15pct
      outerpad=(bottom=10pt)
      ;
   **---Location of the Censor legend indicator--**;
	  keylegend "censor" / 
      location=inside
      position=bottomleft
      ;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 09 Nov 2021 19:41:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-Customize-SGPLOT-for-KM-plot/m-p/779403#M248210</guid>
      <dc:creator>SASuserlot</dc:creator>
      <dc:date>2021-11-09T19:41:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to Customize SGPLOT for KM plot</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-Customize-SGPLOT-for-KM-plot/m-p/779406#M248211</link>
      <description>&lt;P&gt;Check out the very popular SAS macro(s) created by&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/2153"&gt;@JeffMeyers&lt;/a&gt;&amp;nbsp;:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;LI-MESSAGE title="Kaplan-Meier Survival Plotting Macro %NEWSURV" uid="479747" url="https://communities.sas.com/t5/SAS-Communities-Library/Kaplan-Meier-Survival-Plotting-Macro-NEWSURV/m-p/479747#U479747" discussion_style_icon_css="lia-mention-container-editor-message lia-img-icon-tkb-thread lia-fa-icon lia-fa-tkb lia-fa-thread lia-fa"&gt;&lt;/LI-MESSAGE&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;LI-MESSAGE title="A SAS Macro to Perform Kaplan-Meier Multiple Imputation for Survival Analyses with Competing Events" uid="726336" url="https://communities.sas.com/t5/SAS-Global-Forum-Proceedings/A-SAS-Macro-to-Perform-Kaplan-Meier-Multiple-Imputation-for/m-p/726336#U726336" discussion_style_icon_css="lia-mention-container-editor-message lia-img-icon-tkb-thread lia-fa-icon lia-fa-tkb lia-fa-thread lia-fa"&gt;&lt;/LI-MESSAGE&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Nov 2021 19:53:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-Customize-SGPLOT-for-KM-plot/m-p/779406#M248211</guid>
      <dc:creator>ChrisHemedinger</dc:creator>
      <dc:date>2021-11-09T19:53:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to Customize SGPLOT for KM plot</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-Customize-SGPLOT-for-KM-plot/m-p/779418#M248218</link>
      <description>&lt;P&gt;&amp;nbsp;I am new KM plot, where I can find&amp;nbsp; %newsurv macro code?&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SASuserlot_0-1636490942703.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/65536i9C070A7A7196D2EB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SASuserlot_0-1636490942703.png" alt="SASuserlot_0-1636490942703.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Nov 2021 20:49:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-Customize-SGPLOT-for-KM-plot/m-p/779418#M248218</guid>
      <dc:creator>SASuserlot</dc:creator>
      <dc:date>2021-11-09T20:49:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to Customize SGPLOT for KM plot</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-Customize-SGPLOT-for-KM-plot/m-p/779424#M248222</link>
      <description>&lt;P&gt;All of the SAS programs are &lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/Kaplan-Meier-Survival-Plotting-Macro-NEWSURV/m-p/479747#U479747" target="_self"&gt;attached to the article&lt;/A&gt;. I believe the &lt;A href="https://communities.sas.com/kntur85557/attachments/kntur85557/library/3014/10/newsurv_web_042020.sas" target="_self"&gt;most recent version is this one.&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Nov 2021 20:57:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-Customize-SGPLOT-for-KM-plot/m-p/779424#M248222</guid>
      <dc:creator>ChrisHemedinger</dc:creator>
      <dc:date>2021-11-09T20:57:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to Customize SGPLOT for KM plot</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-Customize-SGPLOT-for-KM-plot/m-p/779459#M248243</link>
      <description>&lt;P&gt;This is also a popular paper :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Paper 427-2013&lt;BR /&gt;Creating and Customizing the Kaplan-Meier Survival Plot in PROC LIFETEST&lt;BR /&gt;Warren F. Kuhfeld and Ying So, SAS Institute Inc.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://support.sas.com/resources/papers/proceedings13/427-2013.pdf" target="_blank"&gt;https://support.sas.com/resources/papers/proceedings13/427-2013.pdf&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;From the same author :&lt;BR /&gt;Creating and customizing the Kaplan-Meier Survival Plot in PROC LIFETEST&lt;/P&gt;
&lt;P&gt;&lt;A href="https://video.sas.com/detail/video/2918155168001/creating-and-customizing-the-kaplan-meier-survival-plot-in-proc-lifetest" target="_blank"&gt;https://video.sas.com/detail/video/2918155168001/creating-and-customizing-the-kaplan-meier-survival-plot-in-proc-lifetest&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best regards,&lt;/P&gt;
&lt;P&gt;Koen&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Nov 2021 22:34:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-Customize-SGPLOT-for-KM-plot/m-p/779459#M248243</guid>
      <dc:creator>sbxkoenk</dc:creator>
      <dc:date>2021-11-09T22:34:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to Customize SGPLOT for KM plot</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-Customize-SGPLOT-for-KM-plot/m-p/779542#M248291</link>
      <description>&lt;P&gt;Thanks for references to my papers, but it is far better to check with the SAS documentation.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/v_018/statug/statug_kaplan_toc.htm" target="_blank"&gt;https://documentation.sas.com/doc/en/pgmsascdc/v_018/statug/statug_kaplan_toc.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;For more general customizations, see:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/v_018/statug/statug_odsgraph_toc.htm" target="_blank"&gt;https://documentation.sas.com/doc/en/pgmsascdc/v_018/statug/statug_odsgraph_toc.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/v_018/statug/statug_templt_toc.htm" target="_blank"&gt;https://documentation.sas.com/doc/en/pgmsascdc/v_018/statug/statug_templt_toc.htm&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Nov 2021 11:49:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-Customize-SGPLOT-for-KM-plot/m-p/779542#M248291</guid>
      <dc:creator>WarrenKuhfeld</dc:creator>
      <dc:date>2021-11-10T11:49:28Z</dc:date>
    </item>
  </channel>
</rss>

