<?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: Generating KM curves and changing Y-axis and X-axis in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Generating-KM-curves-and-changing-Y-axis-and-X-axis/m-p/580280#M164813</link>
    <description>Have you checked this page in the documentation?&lt;BR /&gt;&lt;A href="https://documentation.sas.com/?docsetId=statug&amp;amp;docsetVersion=15.1&amp;amp;docsetTarget=statug_kaplan_toc.htm&amp;amp;locale=en" target="_blank"&gt;https://documentation.sas.com/?docsetId=statug&amp;amp;docsetVersion=15.1&amp;amp;docsetTarget=statug_kaplan_toc.htm&amp;amp;locale=en&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Fri, 09 Aug 2019 21:38:27 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2019-08-09T21:38:27Z</dc:date>
    <item>
      <title>Generating KM curves and changing Y-axis and X-axis</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Generating-KM-curves-and-changing-Y-axis-and-X-axis/m-p/580265#M164807</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;I am struggling with changing Y-axis for my KM curves. I would love to get help from you all. I am looking for generating Survival curves for time to cancer (not death), cumulative incidence graphs and Hazard Ratio graphs. I got the following survival curve, but not sure if I did the right way. Also for Hazard Ratio curve, I want to convert the axes (instead of 0.001, 0.002..etc. I want it as 0, 1/1000, 2/1000 ...etc. or something simple like 0 , 1, 2, 3, 4, etc. and a footnote saying the Y axes is per 1000).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KM curve1.jpg" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/31648i73A351F1A33FD333/image-size/large?v=v2&amp;amp;px=999" role="button" title="KM curve1.jpg" alt="KM curve1.jpg" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="HR curve1.jpg" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/31649i2FCD3D80BC257D73/image-size/large?v=v2&amp;amp;px=999" role="button" title="HR curve1.jpg" alt="HR curve1.jpg" /&gt;&lt;/span&gt;Name of the dataset: AP_PDAC&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;My outcome is&amp;nbsp;pancreatic cancer: PDAC (0/1)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Grouping Variable: AP (0/1)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Time variable: time from risk factor AP to PDAC diagnosis date&amp;nbsp;: Dur_Yrs (in years).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you so much!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt; proc lifetest data=AP_PDAC plots=(survival(atrisk) logsurv);
      time Dur_Yrs*PDAC(0);
      strata AP;
   run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 09 Aug 2019 20:30:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Generating-KM-curves-and-changing-Y-axis-and-X-axis/m-p/580265#M164807</guid>
      <dc:creator>sms1891</dc:creator>
      <dc:date>2019-08-09T20:30:58Z</dc:date>
    </item>
    <item>
      <title>Re: Generating KM curves and changing Y-axis and X-axis</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Generating-KM-curves-and-changing-Y-axis-and-X-axis/m-p/580280#M164813</link>
      <description>Have you checked this page in the documentation?&lt;BR /&gt;&lt;A href="https://documentation.sas.com/?docsetId=statug&amp;amp;docsetVersion=15.1&amp;amp;docsetTarget=statug_kaplan_toc.htm&amp;amp;locale=en" target="_blank"&gt;https://documentation.sas.com/?docsetId=statug&amp;amp;docsetVersion=15.1&amp;amp;docsetTarget=statug_kaplan_toc.htm&amp;amp;locale=en&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 09 Aug 2019 21:38:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Generating-KM-curves-and-changing-Y-axis-and-X-axis/m-p/580280#M164813</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-08-09T21:38:27Z</dc:date>
    </item>
    <item>
      <title>Re: Generating KM curves and changing Y-axis and X-axis</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Generating-KM-curves-and-changing-Y-axis-and-X-axis/m-p/582590#M165719</link>
      <description>&lt;P&gt;Hi Reeza,&lt;/P&gt;&lt;P&gt;I used the following macro for changing the Y-axis for my survival curves. However, I did not get the output. Will this work for a SAS enterprise guide on remote desktop login to a research server platform?&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;My outcome is&amp;nbsp; cancer: PDAC (0/1)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Grouping Variable: Treat (1/2/3/4)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Time variable: time from risk factor Treat to cancer diagnosis date&amp;nbsp;: Dur_Yrs (in years). I would like to get survival curves and adjust the Y-axis. The grouping variable Treat = 1 has about 8 million records, Treat =2 has 50,000 records, Treat = 3 has 20,000 records and Treat =4 has 15,000 records.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you so much for your help!&lt;/P&gt;&lt;P&gt;SM&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%ProvideSurvivalMacros

%let yOptions = label="Survival"
                linearopts=(viewmin=0.8 viewmax=1
                            tickvaluelist=(0 .2 .4 .6 .8 1.0));

%CompileSurvivalTemplates

proc lifetest data=PDAC.Year2Over plots=survival;
   time Dur_Yrs * PDAC(0);
   strata Treat;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 20 Aug 2019 20:48:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Generating-KM-curves-and-changing-Y-axis-and-X-axis/m-p/582590#M165719</guid>
      <dc:creator>sms1891</dc:creator>
      <dc:date>2019-08-20T20:48:02Z</dc:date>
    </item>
    <item>
      <title>Re: Generating KM curves and changing Y-axis and X-axis</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Generating-KM-curves-and-changing-Y-axis-and-X-axis/m-p/582593#M165722</link>
      <description>&lt;UL&gt;
&lt;LI&gt;What version of SAS do you have?&lt;/LI&gt;
&lt;LI&gt;Did you get any errors in the log from the code you ran?&lt;/LI&gt;
&lt;LI&gt;Did you run the examples and did they work?&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can check what you have licensed in SAS using:&lt;BR /&gt;&lt;STRONG&gt;proc setinit; run;&lt;/STRONG&gt;&lt;BR /&gt;And what's installed on your system using:&lt;BR /&gt;&lt;STRONG&gt;proc product_status; run;&lt;/STRONG&gt;&lt;BR /&gt;The output will be in the log.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/146852"&gt;@sms1891&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi Reeza,&lt;/P&gt;
&lt;P&gt;I used the following macro for changing the Y-axis for my survival curves. However, I did not get the output. Will this work for a SAS enterprise guide on remote desktop login to a research server platform?&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;My outcome is&amp;nbsp; cancer: PDAC (0/1)&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Grouping Variable: Treat (1/2/3/4)&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Time variable: time from risk factor Treat to cancer diagnosis date&amp;nbsp;: Dur_Yrs (in years). I would like to get survival curves and adjust the Y-axis. The grouping variable Treat = 1 has about 8 million records, Treat =2 has 50,000 records, Treat = 3 has 20,000 records and Treat =4 has 15,000 records.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you so much for your help!&lt;/P&gt;
&lt;P&gt;SM&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%ProvideSurvivalMacros

%let yOptions = label="Survival"
                linearopts=(viewmin=0.8 viewmax=1
                            tickvaluelist=(0 .2 .4 .6 .8 1.0));

%CompileSurvivalTemplates

proc lifetest data=PDAC.Year2Over plots=survival;
   time Dur_Yrs * PDAC(0);
   strata Treat;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Aug 2019 21:00:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Generating-KM-curves-and-changing-Y-axis-and-X-axis/m-p/582593#M165722</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-08-20T21:00:57Z</dc:date>
    </item>
    <item>
      <title>Re: Generating KM curves and changing Y-axis and X-axis</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Generating-KM-curves-and-changing-Y-axis-and-X-axis/m-p/582616#M165743</link>
      <description>&lt;P&gt;Reeza,&lt;/P&gt;&lt;P&gt;I have SAS 9.04, Operating system LIN X64. I uses SAs enterprise guide 7.1. I tried&amp;nbsp;running a different proc template before this code. Do you think what would affect the current code?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;SM&lt;/P&gt;</description>
      <pubDate>Tue, 20 Aug 2019 22:08:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Generating-KM-curves-and-changing-Y-axis-and-X-axis/m-p/582616#M165743</guid>
      <dc:creator>sms1891</dc:creator>
      <dc:date>2019-08-20T22:08:03Z</dc:date>
    </item>
    <item>
      <title>Re: Generating KM curves and changing Y-axis and X-axis</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Generating-KM-curves-and-changing-Y-axis-and-X-axis/m-p/582617#M165744</link>
      <description>Yes it's possible but 9.04 isn't enough for a version, there are 6 different versions of 9.04. The log has the exact version. And yes, if you ran template code before it could have modified your main template so that could mess things up. Did you back up your templates before you started making changes?</description>
      <pubDate>Tue, 20 Aug 2019 22:09:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Generating-KM-curves-and-changing-Y-axis-and-X-axis/m-p/582617#M165744</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-08-20T22:09:48Z</dc:date>
    </item>
    <item>
      <title>Re: Generating KM curves and changing Y-axis and X-axis</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Generating-KM-curves-and-changing-Y-axis-and-X-axis/m-p/582622#M165747</link>
      <description>&lt;P&gt;I&amp;nbsp;am not familiar with proc template, so sorry for my ignorance. I am not sure how to backup a template. One of my colleague gave me a proc template code and asked me to run it before the proc lifetest so I ran it. (see the attached code) I did not make any modifications as I cant understand what it is for.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc template;
     source stat.lifetest.graphics.productlimitsurvival;
define statgraph Stat.Lifetest.Graphics.Productlimitsurvival;
   dynamic NStrata xName plotAtRisk plotCensored plotCL plotHW plotEP labelCL labelHW labelEP maxTime xtickVals xtickValFitPol rowWeights method StratumID classAtRisk plotTest GroupName Transparency
      SecondTitle TestName pValue _byline_ _bytitle_ _byfootnote_;
   BeginGraph;
      if (NSTRATA=1)
         if (EXISTS(STRATUMID))
            entrytitle " Survival Estimate" " for " STRATUMID;
         else
            entrytitle " Survival Estimate" " for " STRATUMID;
         endif;
	     if (PLOTATRISK=1)
            entrytitle "With Number of Patients at Risk" / textattrs=GRAPHVALUETEXT;******THIS WAS MODIFIED from subjects to patients;
         endif;
         layout overlay / xaxisopts=(shortlabel=XNAME offsetmin=.05 linearopts=(viewmax=MAXTIME tickvaluelist=XTICKVALS tickvaluefitpolicy=XTICKVALFITPOL)) yaxisopts=(label="Survival Probability"
            shortlabel="Survival" linearopts=(viewmin=0 viewmax=1 tickvaluelist=(0 .2 .4 .6 .8 1.0)));
            if (PLOTHW=1 AND PLOTEP=0)
               bandplot LimitUpper=HW_UCL LimitLower=HW_LCL x=TIME / modelname="Survival" fillattrs=GRAPHCONFIDENCE name="HW" legendlabel=LABELHW;
            endif;
            if (PLOTHW=0 AND PLOTEP=1)
               bandplot LimitUpper=EP_UCL LimitLower=EP_LCL x=TIME / modelname="Survival" fillattrs=GRAPHCONFIDENCE name="EP" legendlabel=LABELEP;
            endif;
            if (PLOTHW=1 AND PLOTEP=1)
               bandplot LimitUpper=HW_UCL LimitLower=HW_LCL x=TIME / modelname="Survival" fillattrs=GRAPHDATA1 datatransparency=.55 name="HW" legendlabel=LABELHW;
               bandplot LimitUpper=EP_UCL LimitLower=EP_LCL x=TIME / modelname="Survival" fillattrs=GRAPHDATA2 datatransparency=.55 name="EP" legendlabel=LABELEP;
            endif;
            if (PLOTCL=1)
               if (PLOTHW=1 OR PLOTEP=1)
                  bandplot LimitUpper=SDF_UCL LimitLower=SDF_LCL x=TIME / modelname="Survival" display=(outline) outlineattrs=GRAPHPREDICTIONLIMITS name="CL" legendlabel=LABELCL;
               else
                  bandplot LimitUpper=SDF_UCL LimitLower=SDF_LCL x=TIME / modelname="Survival" fillattrs=GRAPHCONFIDENCE name="CL" legendlabel=LABELCL;
               endif;
            endif;
            stepplot y=SURVIVAL x=TIME / name="Survival" rolename=(_tip1=ATRISK _tip2=EVENT) tiplabel=(_tip1="Number at Risk" _tip2="Observed Events") tip=(x y _tip1 _tip2) legendlabel="Survival";
            if (PLOTCENSORED=1)
               scatterplot y=CENSORED x=TIME / markerattrs=(symbol=plus) tiplabel=(y="Survival Probability") name="Censored" legendlabel="Censored";
            endif;
            if (PLOTCL=1 OR PLOTHW=1 OR PLOTEP=1)
               discretelegend "Censored" "CL" "HW" "EP" / location=outside halign=center;
            else
               if (PLOTCENSORED=1)
                  discretelegend "Censored" / location=inside autoalign=(topright bottomleft);
               endif;
            endif;
            if (PLOTATRISK=1)
               innermargin / align=bottom;
                  axistable x=TATRISK value=ATRISK / display=(label) valueattrs=(size=7pt);
               endinnermargin;
            endif;
         endlayout;
      else
         entrytitle "Kaplan Meier Curves for All cause mortality"  ;
		 if (PLOTATRISK=1)
            entrytitle "With Number of Participants at Risk" / textattrs=GRAPHVALUETEXT;******THIS WAS MODIFIED from subjects to patients;
         endif;
        * if (EXISTS(SECONDTITLE))
            entrytitle SECONDTITLE / textattrs=GRAPHVALUETEXT;
         *endif;
         layout overlay / xaxisopts=(shortlabel=XNAME offsetmin=.05 linearopts=(viewmax=MAXTIME tickvaluelist=XTICKVALS tickvaluefitpolicy=XTICKVALFITPOL)) yaxisopts=(label="Survival Probability"
            shortlabel="Survival" linearopts=(viewmin=.6 viewmax=1 tickvaluelist=(.6 .7 .8 .9 1)));
            if (PLOTHW=1)
               bandplot LimitUpper=HW_UCL LimitLower=HW_LCL x=TIME / group=STRATUM index=STRATUMNUM modelname="Survival" datatransparency=Transparency;
            endif;
            if (PLOTEP=1)
               bandplot LimitUpper=EP_UCL LimitLower=EP_LCL x=TIME / group=STRATUM index=STRATUMNUM modelname="Survival" datatransparency=Transparency;
            endif;
            if (PLOTCL=1)
               if (PLOTHW=1 OR PLOTEP=1)
                  bandplot LimitUpper=SDF_UCL LimitLower=SDF_LCL x=TIME / group=STRATUM index=STRATUMNUM modelname="Survival" display=(outline) outlineattrs=(pattern=ShortDash);
               else
                  bandplot LimitUpper=SDF_UCL LimitLower=SDF_LCL x=TIME / group=STRATUM index=STRATUMNUM modelname="Survival" datatransparency=Transparency;
               endif;
            endif;
            stepplot y=SURVIVAL x=TIME / group=STRATUM index=STRATUMNUM name="Survival" rolename=(_tip1=ATRISK _tip2=EVENT) tiplabel=(_tip1="Number at Risk" _tip2="Observed Events") tip=(x y _tip1
               _tip2);
            if (PLOTCENSORED=1)
               scatterplot y=CENSORED x=TIME / group=STRATUM index=STRATUMNUM tiplabel=(y="Survival Probability") markerattrs=(symbol=plus);
            endif;
            if (PLOTATRISK=1)
               innermargin / align=bottom;
                  axistable x=TATRISK value=ATRISK / display=(label) valueattrs=(size=7pt) class=CLASSATRISK colorgroup=CLASSATRISK;
               endinnermargin;
            endif;
            DiscreteLegend "Survival" / title=GROUPNAME location=outside;
            if (PLOTCENSORED=1)
               if (PLOTTEST=1)
                  layout gridded / rows=2 autoalign=(TOPRIGHT BOTTOMLEFT TOP BOTTOM) border=true BackgroundColor=GraphWalls:Color Opaque=true;
                     entry "+ Censored";
                     if (PVALUE &amp;lt; .0001)
                        entry TESTNAME " p " eval (PUT(PVALUE, PVALUE6.4));
                     else
                        entry TESTNAME " p=" eval (PUT(PVALUE, PVALUE6.4));
                     endif;
                  endlayout;
               else
                  layout gridded / rows=1 autoalign=(TOPRIGHT BOTTOMLEFT TOP BOTTOM) border=true BackgroundColor=GraphWalls:Color Opaque=true;
                     entry "+ Censored";
                  endlayout;
               endif;
            else
               if (PLOTTEST=1)
                  layout gridded / rows=1 autoalign=(TOPRIGHT BOTTOMLEFT TOP BOTTOM) border=true BackgroundColor=GraphWalls:Color Opaque=true;
                     if (PVALUE &amp;lt; .0001)
                        entry TESTNAME " p " eval (PUT(PVALUE, PVALUE6.4));
                     else
                        entry TESTNAME " p=" eval (PUT(PVALUE, PVALUE6.4));
                     endif;
                  endlayout;
               endif;
            endif;
         endlayout;
      endif;
      if (_BYTITLE_)
         entrytitle _BYLINE_ / textattrs=GRAPHVALUETEXT;
      else
         if (_BYFOOTNOTE_)
            entryfootnote halign=left _BYLINE_;
         endif;
      endif;
   EndGraph;
end;
run;


&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My SAS is 9.04.01M5P091317&lt;/P&gt;</description>
      <pubDate>Tue, 20 Aug 2019 22:16:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Generating-KM-curves-and-changing-Y-axis-and-X-axis/m-p/582622#M165747</guid>
      <dc:creator>sms1891</dc:creator>
      <dc:date>2019-08-20T22:16:58Z</dc:date>
    </item>
    <item>
      <title>Re: Generating KM curves and changing Y-axis and X-axis</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Generating-KM-curves-and-changing-Y-axis-and-X-axis/m-p/583345#M166059</link>
      <description>&lt;P&gt;Hi Reeza,&lt;/P&gt;&lt;P&gt;Did you get my reply yesterday? Would love to get your feedback.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Sat&lt;/P&gt;</description>
      <pubDate>Thu, 22 Aug 2019 22:10:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Generating-KM-curves-and-changing-Y-axis-and-X-axis/m-p/583345#M166059</guid>
      <dc:creator>sms1891</dc:creator>
      <dc:date>2019-08-22T22:10:03Z</dc:date>
    </item>
  </channel>
</rss>

