<?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 do I plot the spline effect in PHREG? in SAS Health and Life Sciences</title>
    <link>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/How-do-I-plot-the-spline-effect-in-PHREG/m-p/411398#M2153</link>
    <description>&lt;P&gt;Hi, can you please tell me what is matrix package? Is it a R package?&lt;/P&gt;</description>
    <pubDate>Wed, 08 Nov 2017 01:07:47 GMT</pubDate>
    <dc:creator>deepnorth3</dc:creator>
    <dc:date>2017-11-08T01:07:47Z</dc:date>
    <item>
      <title>How do I plot the spline effect in PHREG?</title>
      <link>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/How-do-I-plot-the-spline-effect-in-PHREG/m-p/108326#M1809</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am new to SAS and am having trouble graphing the SPLINE constructed effect in PHREG.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My question is, what is the best way to draw a spline using the output from the SPLINE effect in PHREG? This is a survival analysis so it seems to me that using TRANSREG would not work as well.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/* Here is the PHREG statement I am using:&amp;nbsp;&amp;nbsp;&amp;nbsp; */&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;PROC PHREG DATA=WORK.TMP0TempTableInput&lt;BR /&gt;;&lt;BR /&gt; CLASS smoking(ref = 'N');&lt;BR /&gt; CLASS AgeCategory(ref = '1');&lt;BR /&gt; EFFECT spl = spline(BMI / degree=3 knotmethod=rangefractions(.05 .25 .75 .95) Details);&lt;BR /&gt; MODEL MonthsToDeathEnd * CensoredDeath (1) = spl Female Smoking AgeCategory HxCAD HxCHF HxCVA HxPVD HxDiabetes HxCOPD Charlson weightedMPR weightedtownsend / &lt;BR /&gt;&amp;nbsp; TIES=BRESLOW&lt;BR /&gt;&amp;nbsp; RISKLIMITS ALPHA=0.05&lt;BR /&gt;&amp;nbsp; SELECTION=NONE&lt;BR /&gt;; &lt;/P&gt;&lt;P&gt;RUN;TITLE; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/* Here is an example of the type of output I am trying to generate: */&lt;/P&gt;&lt;P&gt;&lt;IMG alt="spline example.jpg" class="jive-image" src="https://communities.sas.com/legacyfs/online/3095_spline example.jpg" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Feb 2013 16:13:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/How-do-I-plot-the-spline-effect-in-PHREG/m-p/108326#M1809</guid>
      <dc:creator>wenxinxu</dc:creator>
      <dc:date>2013-02-13T16:13:06Z</dc:date>
    </item>
    <item>
      <title>Re: How do I plot the spline effect in PHREG?</title>
      <link>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/How-do-I-plot-the-spline-effect-in-PHREG/m-p/108327#M1810</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Just wondering whether you know by now how to generate the plot you showed? I am aiming for a similar plot after a similar PHREG statement.&lt;/P&gt;&lt;P&gt;Many thanks in advance!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 May 2013 01:02:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/How-do-I-plot-the-spline-effect-in-PHREG/m-p/108327#M1810</guid>
      <dc:creator>DanielleSchoenaker</dc:creator>
      <dc:date>2013-05-30T01:02:19Z</dc:date>
    </item>
    <item>
      <title>Re: How do I plot the spline effect in PHREG?</title>
      <link>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/How-do-I-plot-the-spline-effect-in-PHREG/m-p/108328#M1811</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I sometime also deals with this problem. I have not found a way to plot the spline-curve created by the effect-estimates. I therefore only use the spline-feature in the effect-statement when I want to adjust for some covariate which own effect is not of interest.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I want to plot the spline, then I do all the coding wihout use of the effectstatement. That is (1) create the coefficients which will be used as regressors in phreg (or some other regression procedure), (2) from the estimates a plot dataset can be created and at last (3) plot the curves with proc gplot. It can be it can be done more easily, so I encourage others to come with better solutions. With some small modifications, it is also possible to use the code below to plot a time-dependent effect in a cox-regression.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There are some matrix-calculations, and it is thefore neccesary to have run the matrix-package first. The matrixalgebra file which are included is the one that is attached this post: &lt;A __default_attr="1570" __jive_macro_name="idea" class="jive_macro jive_macro_idea" href="https://communities.sas.com/"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is an example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*k is is the number of knots;&lt;/P&gt;&lt;P&gt;%let k=9;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%include "" ; /*insert path to the matrix package */&lt;/P&gt;&lt;P&gt;option cmplib=work.func; /*this should be the same location as the one used in the matrix-package*/&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*for this example I also simulate data;&lt;/P&gt;&lt;P&gt;data simulation;&lt;/P&gt;&lt;P&gt;&amp;nbsp; array spl{%eval(&amp;amp;k.-1)};&lt;/P&gt;&lt;P&gt;&amp;nbsp; array knots{&amp;amp;k.} _temporary_&amp;nbsp; (-0.4,-0.3,-0.2,-0.1,0,0.1,0.2,0.3,0.4)&amp;nbsp; ; /*this is my knot-points*/&lt;/P&gt;&lt;P&gt;&amp;nbsp; do j=1 to 10000;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; * a is my covariate, which is here some number between zero and one.;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; a=ranuni(-1)-0.5;&lt;/P&gt;&lt;P&gt;*t is my survival time;&lt;/P&gt;&lt;P&gt;t=-log(ranuni(-1))/(exp(-(a)**2));&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; *then create the spline-coefficients;&lt;/P&gt;&lt;P&gt;ref=0; *0 is here my reference value;&lt;/P&gt;&lt;P&gt;spl[1]=a-ref;&lt;/P&gt;&lt;P&gt;do i=1 to &amp;amp;k.-2;&lt;/P&gt;&lt;P&gt;&amp;nbsp; spl[i+1]=max(a-knots&lt;I&gt;,0)**3&lt;/I&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -((knots[&amp;amp;k]-knots&lt;I&gt;)/(knots[&amp;amp;k]-knots[&amp;amp;k-1]))*max(a-knots[&amp;amp;k.-1],0)**3&lt;/I&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; +((knots[&amp;amp;k-1]-knots&lt;I&gt;)/(knots[&amp;amp;k]-knots[&amp;amp;k-1]))*max(a-knots[&amp;amp;k.],0)**3&lt;/I&gt;&lt;/P&gt;&lt;P&gt;-(max(ref-knots&lt;I&gt;,0)**3&lt;/I&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; -((knots[&amp;amp;k]-knots&lt;I&gt;)/(knots[&amp;amp;k]-knots[&amp;amp;k-1]))*max(ref-knots[&amp;amp;k.-1],0)**3&lt;/I&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; +((knots[&amp;amp;k-1]-knots&lt;I&gt;)/(knots[&amp;amp;k]-knots[&amp;amp;k-1]))*max(ref-knots[&amp;amp;k.],0)**3);&lt;/I&gt;&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; output;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*because I also wants pointwise confidence-limits I put the covariance-matrix into a dataset "outest";&lt;/P&gt;&lt;P&gt;proc phreg data=simulation covout outest=outest;&lt;/P&gt;&lt;P&gt;&amp;nbsp; model t=spl1-spl%eval(&amp;amp;k.-1);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data plot;&lt;/P&gt;&lt;P&gt;&amp;nbsp; array knots{&amp;amp;k.} _temporary_ (-0.4,-0.3,-0.2,-0.1,0,0.1,0.2,0.3,0.4) ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; array spl{%eval(&amp;amp;k.-1)};&lt;/P&gt;&lt;P&gt;&amp;nbsp; array variance{%eval(&amp;amp;k.-1),%eval(&amp;amp;k.-1)} _temporary_;&lt;/P&gt;&lt;P&gt;&amp;nbsp; array beta{%eval(&amp;amp;k.-1),1} _temporary_;&lt;/P&gt;&lt;P&gt;&amp;nbsp; array design{1,%eval(&amp;amp;k.-1)} _temporary_;&lt;/P&gt;&lt;P&gt;&amp;nbsp; array designt{%eval(&amp;amp;k.-1),1} _temporary_;&lt;/P&gt;&lt;P&gt;&amp;nbsp; array logest{1,1} _temporary_;&lt;/P&gt;&lt;P&gt;&amp;nbsp; array var{1,1} _temporary_;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*read in the estimates;&lt;/P&gt;&lt;P&gt;&amp;nbsp; do until (eof);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; set outest end=eof;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; do i=1 to &amp;amp;k-1.;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if _type_='PARMS' then beta[i,1]=spl&lt;I&gt;;&lt;/I&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else variance[i,input(substr(_name_,4,length(_name_)-3),best.)]=spl&lt;I&gt;;&lt;/I&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp; call show(variance);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*create the curve and confidencelimits;&lt;/P&gt;&lt;P&gt;ref=0;&lt;/P&gt;&lt;P&gt;do a=-0.5 to 0.5 by 0.001;&lt;/P&gt;&lt;P&gt;design[1,1]=a-ref;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;do i=1 to &amp;amp;k.-2;&lt;/P&gt;&lt;P&gt;design[1,i+1]=max(a-knots&lt;I&gt;,0)**3&lt;/I&gt;&lt;/P&gt;&lt;P&gt;-((knots[&amp;amp;k]-knots&lt;I&gt;)/(knots[&amp;amp;k]-knots[&amp;amp;k-1]))*max(a-knots[&amp;amp;k.-1],0)**3&lt;/I&gt;&lt;/P&gt;&lt;P&gt;+((knots[&amp;amp;k-1]-knots&lt;I&gt;)/(knots[&amp;amp;k]-knots[&amp;amp;k-1]))*max(a-knots[&amp;amp;k.],0)**3&lt;/I&gt;&lt;/P&gt;&lt;P&gt;-(max(ref-knots&lt;I&gt;,0)**3&lt;/I&gt;&lt;/P&gt;&lt;P&gt;-((knots[&amp;amp;k]-knots&lt;I&gt;)/(knots[&amp;amp;k]-knots[&amp;amp;k-1]))*max(ref-knots[&amp;amp;k.-1],0)**3&lt;/I&gt;&lt;/P&gt;&lt;P&gt;+((knots[&amp;amp;k-1]-knots&lt;I&gt;)/(knots[&amp;amp;k]-knots[&amp;amp;k-1]))*max(ref-knots[&amp;amp;k.],0)**3);&lt;/I&gt;&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; call trans(design,designt);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; call multiplicer(design,beta,logest);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; call multiplicer3(design,variance,designt,var);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; rr=exp(logest[1,1]);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; lower=exp(logest[1,1]-1.96*sqrt(var[1,1]));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; upper=exp(logest[1,1]+1.96*sqrt(var[1,1]));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; output;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp; keep a rr lower upper;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;symbol1 i=join v=none l=1 c=black;&lt;/P&gt;&lt;P&gt;symbol2 i=join v=none l=2 c=black;&lt;/P&gt;&lt;P&gt;symbol3 i=join v=none l=2 c=black;&lt;/P&gt;&lt;P&gt;proc gplot data=plot;&lt;/P&gt;&lt;P&gt;&amp;nbsp; plot (rr lower upper)*a/overlay;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 04 May 2014 09:43:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/How-do-I-plot-the-spline-effect-in-PHREG/m-p/108328#M1811</guid>
      <dc:creator>JacobSimonsen</dc:creator>
      <dc:date>2014-05-04T09:43:41Z</dc:date>
    </item>
    <item>
      <title>Re: How do I plot the spline effect in PHREG?</title>
      <link>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/How-do-I-plot-the-spline-effect-in-PHREG/m-p/108329#M1812</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to do the same approximately.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Current code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ods graphics on;&lt;/P&gt;&lt;P&gt;proc phreg data=splinedata ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; effect lala=spline(log_lab/knotmethod=list(1 3 5));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; model time*event(0)=lala;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;Anyone knows how to plot this? &lt;SPAN style="font-size: 13.3333330154419px;"&gt;I want to plot on the y-axis HR, and a continuous variable on the x-axis.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm using SAS 9.3.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anyone familiar with the %rcs_reg macro by Desquibet (&lt;A href="http://onlinelibrary.wiley.com/doi/10.1002/sim.3841/abstract" title="http://onlinelibrary.wiley.com/doi/10.1002/sim.3841/abstract"&gt;Dose-response analyses using restricted cubic spline functions in public health research - Desquilbet - 2010 - Statistics in Medicine - Wiley Online Library&lt;/A&gt;)?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;Tessa&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Apr 2015 12:46:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/How-do-I-plot-the-spline-effect-in-PHREG/m-p/108329#M1812</guid>
      <dc:creator>TessaRH</dc:creator>
      <dc:date>2015-04-01T12:46:10Z</dc:date>
    </item>
    <item>
      <title>Re: How do I plot the spline effect in PHREG?</title>
      <link>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/How-do-I-plot-the-spline-effect-in-PHREG/m-p/108330#M1813</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think something like this should do it:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc phreg data=temp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; effect bmiS = spline(bmi / basis=tpf(noint) NATURALCUBIC details knotmethod=list(18.0175 20.5289 22.4059 27.4693) );&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; model time*event(0)=bmiS&amp;nbsp; / rl=wald ties=EFRON ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; store sasuser.coxr;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%macro est(ref=20, start=15, end=35, by=0.1);&lt;/P&gt;&lt;P&gt;%Do i = 1 %To %eval(%SysFunc( Ceil( %SysEvalF( ( &amp;amp;End - &amp;amp;Start ) / &amp;amp;By ) ) ) +1) ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; %Let value=%SysEvalF( ( &amp;amp;Start - &amp;amp;By ) + ( &amp;amp;By * &amp;amp;I ) ) ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; estimate "&amp;amp;value." bmis [-1, &amp;amp;ref] [1, &amp;amp;value] / exp cl;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; %end;&lt;/P&gt;&lt;P&gt;%mend est;&lt;/P&gt;&lt;P&gt;ods html select none;&lt;/P&gt;&lt;P&gt;ods rtf select none;&lt;/P&gt;&lt;P&gt;ods dataset Estimates=Estimates;&lt;/P&gt;&lt;P&gt;proc plm restore=sasuser.coxr;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; %est(ref=20, start=16, end=35, by=0.01);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;ods html select all;&lt;/P&gt;&lt;P&gt;ods rtf select all;&lt;/P&gt;&lt;P&gt;data estimates;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; set estimates;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; BMI=label*1;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;proc sgplot data=estimates NOAUTOLEGEND Noborder;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Series y=ExpEstimate x=BMI / ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Series y=LowerExp x=BMI / LINEATTRS=(pattern=ShortDash color=Black THICKNESS=1);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Series y=UpperExp x=BMI / LINEATTRS=(pattern=ShortDash color=Black THICKNESS=1);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; REFLINE 1 / axis=y;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; REFLINE 20 / Axis=X LINEATTRS=(pattern=ThinDot color=Black THICKNESS=1);;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; yaxis Values=(0.8 1 1.5 2 3 4 6 8 10) Label="Hazard ratio" Type=LOG LABELATTRS=(weight=BOLD);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; xaxis min=16 VALUES=(16 to 35 by 1) LABELATTRS=(weight=BOLD);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Jun 2015 15:13:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/How-do-I-plot-the-spline-effect-in-PHREG/m-p/108330#M1813</guid>
      <dc:creator>LinusS_</dc:creator>
      <dc:date>2015-06-03T15:13:45Z</dc:date>
    </item>
    <item>
      <title>Re: How do I plot the spline effect in PHREG?</title>
      <link>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/How-do-I-plot-the-spline-effect-in-PHREG/m-p/108331#M1814</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi LinusS.,&lt;/P&gt;&lt;P&gt;Thank you! &lt;SPAN style="font-size: 13.3333330154419px;"&gt;This works well for PHREG. I am also looking for a way to draw a spline based on the survey data. I think the above code &lt;/SPAN&gt;would not work well for the PROC SURVEYPHREG, because there is not the effect statement in SURVEYPHREG. Is there a best way &lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; background-color: #ffffff;"&gt;to draw a spline after SURVEYPHREG? &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; background-color: #ffffff;"&gt;Thanks a lot!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Xi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Aug 2015 03:53:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/How-do-I-plot-the-spline-effect-in-PHREG/m-p/108331#M1814</guid>
      <dc:creator>bb_heihei</dc:creator>
      <dc:date>2015-08-26T03:53:14Z</dc:date>
    </item>
    <item>
      <title>Re: How do I plot the spline effect in PHREG?</title>
      <link>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/How-do-I-plot-the-spline-effect-in-PHREG/m-p/411398#M2153</link>
      <description>&lt;P&gt;Hi, can you please tell me what is matrix package? Is it a R package?&lt;/P&gt;</description>
      <pubDate>Wed, 08 Nov 2017 01:07:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/How-do-I-plot-the-spline-effect-in-PHREG/m-p/411398#M2153</guid>
      <dc:creator>deepnorth3</dc:creator>
      <dc:date>2017-11-08T01:07:47Z</dc:date>
    </item>
    <item>
      <title>Re: How do I plot the spline effect in PHREG?</title>
      <link>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/How-do-I-plot-the-spline-effect-in-PHREG/m-p/626357#M2294</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10078"&gt;@JacobSimonsen&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;P&gt;I sometime also deals with this problem. I have not found a way to plot the spline-curve created by the effect-estimates. I therefore only use the spline-feature in the effect-statement when I want to adjust for some covariate which own effect is not of interest.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I want to plot the spline, then I do all the coding wihout use of the effectstatement. That is (1) create the coefficients which will be used as regressors in phreg (or some other regression procedure), (2) from the estimates a plot dataset can be created and at last (3) plot the curves with proc gplot. It can be it can be done more easily, so I encourage others to come with better solutions. With some small modifications, it is also possible to use the code below to plot a time-dependent effect in a cox-regression.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There are some matrix-calculations, and it is thefore neccesary to have run the matrix-package first. The matrixalgebra file which are included is the one that is attached this post:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is an example:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;*k is is the number of knots;&lt;/P&gt;&lt;P&gt;%let k=9;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%include "" ; /*insert path to the matrix package */&lt;/P&gt;&lt;P&gt;option cmplib=work.func; /*this should be the same location as the one used in the matrix-package*/&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;*for this example I also simulate data;&lt;/P&gt;&lt;P&gt;data simulation;&lt;/P&gt;&lt;P&gt;&amp;nbsp; array spl{%eval(&amp;amp;k.-1)};&lt;/P&gt;&lt;P&gt;&amp;nbsp; array knots{&amp;amp;k.} _temporary_&amp;nbsp; (-0.4,-0.3,-0.2,-0.1,0,0.1,0.2,0.3,0.4)&amp;nbsp; ; /*this is my knot-points*/&lt;/P&gt;&lt;P&gt;&amp;nbsp; do j=1 to 10000;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; * a is my covariate, which is here some number between zero and one.;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; a=ranuni(-1)-0.5;&lt;/P&gt;&lt;P&gt;*t is my survival time;&lt;/P&gt;&lt;P&gt;t=-log(ranuni(-1))/(exp(-(a)**2));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; *then create the spline-coefficients;&lt;/P&gt;&lt;P&gt;ref=0; *0 is here my reference value;&lt;/P&gt;&lt;P&gt;spl[1]=a-ref;&lt;/P&gt;&lt;P&gt;do i=1 to &amp;amp;k.-2;&lt;/P&gt;&lt;P&gt;&amp;nbsp; spl[i+1]=max(a-knots&lt;I&gt;,0)**3&lt;/I&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -((knots[&amp;amp;k]-knots&lt;I&gt;)/(knots[&amp;amp;k]-knots[&amp;amp;k-1]))*max(a-knots[&amp;amp;k.-1],0)**3&lt;/I&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; +((knots[&amp;amp;k-1]-knots&lt;I&gt;)/(knots[&amp;amp;k]-knots[&amp;amp;k-1]))*max(a-knots[&amp;amp;k.],0)**3&lt;/I&gt;&lt;/P&gt;&lt;P&gt;-(max(ref-knots&lt;I&gt;,0)**3&lt;/I&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; -((knots[&amp;amp;k]-knots&lt;I&gt;)/(knots[&amp;amp;k]-knots[&amp;amp;k-1]))*max(ref-knots[&amp;amp;k.-1],0)**3&lt;/I&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; +((knots[&amp;amp;k-1]-knots&lt;I&gt;)/(knots[&amp;amp;k]-knots[&amp;amp;k-1]))*max(ref-knots[&amp;amp;k.],0)**3);&lt;/I&gt;&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; output;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;*because I also wants pointwise confidence-limits I put the covariance-matrix into a dataset "outest";&lt;/P&gt;&lt;P&gt;proc phreg data=simulation covout outest=outest;&lt;/P&gt;&lt;P&gt;&amp;nbsp; model t=spl1-spl%eval(&amp;amp;k.-1);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data plot;&lt;/P&gt;&lt;P&gt;&amp;nbsp; array knots{&amp;amp;k.} _temporary_ (-0.4,-0.3,-0.2,-0.1,0,0.1,0.2,0.3,0.4) ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; array spl{%eval(&amp;amp;k.-1)};&lt;/P&gt;&lt;P&gt;&amp;nbsp; array variance{%eval(&amp;amp;k.-1),%eval(&amp;amp;k.-1)} _temporary_;&lt;/P&gt;&lt;P&gt;&amp;nbsp; array beta{%eval(&amp;amp;k.-1),1} _temporary_;&lt;/P&gt;&lt;P&gt;&amp;nbsp; array design{1,%eval(&amp;amp;k.-1)} _temporary_;&lt;/P&gt;&lt;P&gt;&amp;nbsp; array designt{%eval(&amp;amp;k.-1),1} _temporary_;&lt;/P&gt;&lt;P&gt;&amp;nbsp; array logest{1,1} _temporary_;&lt;/P&gt;&lt;P&gt;&amp;nbsp; array var{1,1} _temporary_;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;*read in the estimates;&lt;/P&gt;&lt;P&gt;&amp;nbsp; do until (eof);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; set outest end=eof;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; do i=1 to &amp;amp;k-1.;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if _type_='PARMS' then beta[i,1]=spl&lt;I&gt;;&lt;/I&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else variance[i,input(substr(_name_,4,length(_name_)-3),best.)]=spl&lt;I&gt;;&lt;/I&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp; call show(variance);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;*create the curve and confidencelimits;&lt;/P&gt;&lt;P&gt;ref=0;&lt;/P&gt;&lt;P&gt;do a=-0.5 to 0.5 by 0.001;&lt;/P&gt;&lt;P&gt;design[1,1]=a-ref;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;do i=1 to &amp;amp;k.-2;&lt;/P&gt;&lt;P&gt;design[1,i+1]=max(a-knots&lt;I&gt;,0)**3&lt;/I&gt;&lt;/P&gt;&lt;P&gt;-((knots[&amp;amp;k]-knots&lt;I&gt;)/(knots[&amp;amp;k]-knots[&amp;amp;k-1]))*max(a-knots[&amp;amp;k.-1],0)**3&lt;/I&gt;&lt;/P&gt;&lt;P&gt;+((knots[&amp;amp;k-1]-knots&lt;I&gt;)/(knots[&amp;amp;k]-knots[&amp;amp;k-1]))*max(a-knots[&amp;amp;k.],0)**3&lt;/I&gt;&lt;/P&gt;&lt;P&gt;-(max(ref-knots&lt;I&gt;,0)**3&lt;/I&gt;&lt;/P&gt;&lt;P&gt;-((knots[&amp;amp;k]-knots&lt;I&gt;)/(knots[&amp;amp;k]-knots[&amp;amp;k-1]))*max(ref-knots[&amp;amp;k.-1],0)**3&lt;/I&gt;&lt;/P&gt;&lt;P&gt;+((knots[&amp;amp;k-1]-knots&lt;I&gt;)/(knots[&amp;amp;k]-knots[&amp;amp;k-1]))*max(ref-knots[&amp;amp;k.],0)**3);&lt;/I&gt;&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; call trans(design,designt);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; call multiplicer(design,beta,logest);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; call multiplicer3(design,variance,designt,var);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; rr=exp(logest[1,1]);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; lower=exp(logest[1,1]-1.96*sqrt(var[1,1]));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; upper=exp(logest[1,1]+1.96*sqrt(var[1,1]));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; output;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp; keep a rr lower upper;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;symbol1 i=join v=none l=1 c=black;&lt;/P&gt;&lt;P&gt;symbol2 i=join v=none l=2 c=black;&lt;/P&gt;&lt;P&gt;symbol3 i=join v=none l=2 c=black;&lt;/P&gt;&lt;P&gt;proc gplot data=plot;&lt;/P&gt;&lt;P&gt;&amp;nbsp; plot (rr lower upper)*a/overlay;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Hello, It has been a while since post appeared. I was recently doing to search for an approach to plot HR against a continuous variable and I came across this thread. You are referring to a matrix package attached to your post ("&lt;SPAN&gt;There are some matrix-calculations, and it is therefore necessary&amp;nbsp;to have run the matrix-package first. The matrixalgebra file which are included is the one that is attached this post"). There does not seem to be any attachment. Could you re-post your message with the attachment? Or, if the matrix package is embedded in the post, could you point to that? Would greatly appreciate your help.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Srini Rajagopalan&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Feb 2020 21:28:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/How-do-I-plot-the-spline-effect-in-PHREG/m-p/626357#M2294</guid>
      <dc:creator>SriniR</dc:creator>
      <dc:date>2020-02-20T21:28:00Z</dc:date>
    </item>
    <item>
      <title>Re: How do I plot the spline effect in PHREG?</title>
      <link>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/How-do-I-plot-the-spline-effect-in-PHREG/m-p/707925#M2323</link>
      <description>&lt;P&gt;Thanks &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/46960"&gt;@LinusS_&lt;/a&gt;&amp;nbsp;for the code! I'm wondering if you know how to modify it to get the estimates by sex? I tried the following but it didn't work, it looks especially wonky for females.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;%macro est(ref=20, start=15, end=35, by=0.1);
   %Do i = 1 %To %eval(%SysFunc( Ceil( %SysEvalF( ( &amp;amp;End - &amp;amp;Start ) / &amp;amp;By ) ) ) +1) ;
      %Let value=%SysEvalF( ( &amp;amp;Start - &amp;amp;By ) + ( &amp;amp;By * &amp;amp;I ) ) ;
         estimate "&amp;amp;value. male" sex 0 bmis [-1, &amp;amp;ref] [1, &amp;amp;value] / exp cl;
         estimate "&amp;amp;value. female" sex 1 bmis [-1, &amp;amp;ref] [1, &amp;amp;value] / exp cl;
   %end;
%mend est;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Dec 2020 16:37:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/How-do-I-plot-the-spline-effect-in-PHREG/m-p/707925#M2323</guid>
      <dc:creator>sseb</dc:creator>
      <dc:date>2020-12-23T16:37:18Z</dc:date>
    </item>
    <item>
      <title>Re: How do I plot the spline effect in PHREG?</title>
      <link>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/How-do-I-plot-the-spline-effect-in-PHREG/m-p/707983#M2324</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/248131"&gt;@sseb&lt;/a&gt;&amp;nbsp; What you're trying to estimate doesn't really make sense unless you have an interaction between sex and BMI (without an interaction the HR is the same for both males and females). If you include an interaction I think it would be something like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;estimate "&amp;amp;value. &amp;amp;year. sex level 1" bmis [-1, &amp;amp;ref.] [1, &amp;amp;value.] sex*bmis [-1, &amp;amp;ref. 1] [1, &amp;amp;value. 1]/ exp cl cov;&lt;BR /&gt;estimate "&amp;amp;value. &amp;amp;year. sex level 2" bmis [-1, &amp;amp;ref.] [1, &amp;amp;value.] sex*bmis [-1, &amp;amp;ref. 2] [1, &amp;amp;value. 2]/ exp cl cov&lt;/PRE&gt;&lt;P&gt;where sex is a class variable. This should be relatively easy to check since the interaction only matters for the non-reference level, so for the reference level of sex the two lines&lt;/P&gt;&lt;PRE&gt;estimate "&amp;amp;value. &amp;amp;year. sex level 2 (ref)" bmis [-1, &amp;amp;ref.] [1, &amp;amp;value.] sex*bmis [-1, &amp;amp;ref. 2] [1, &amp;amp;value. 2]/ exp cl cov
estimate "&amp;amp;value. &amp;amp;year." bmis [-1, &amp;amp;ref.] [1, &amp;amp;value.] / exp cl cov&lt;/PRE&gt;&lt;P&gt;should produce identical results, so you can just change which level is the reference and use the simpler code.&lt;/P&gt;</description>
      <pubDate>Wed, 23 Dec 2020 20:50:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/How-do-I-plot-the-spline-effect-in-PHREG/m-p/707983#M2324</guid>
      <dc:creator>LinusS_</dc:creator>
      <dc:date>2020-12-23T20:50:11Z</dc:date>
    </item>
    <item>
      <title>Re: How do I plot the spline effect in PHREG?</title>
      <link>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/How-do-I-plot-the-spline-effect-in-PHREG/m-p/708154#M2325</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Original post:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/46960"&gt;@LinusS_&lt;/a&gt;&amp;nbsp;Thanks for the quick reply! Yes, I forgot to mention in my previous comment that I had added an interaction term between bmi and sex.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried the code you commented, but I'm getting an error saying 'the level 21 is not valid for CLASS variable sex. The level specifications for this variable must range from 1 to 2'. (Note that 21 is the reference I set for BMI). I assume this has something to do with the order of the estimate statement and SAS thinking the 21 is for sex and not the 1/2 at the end, but I don't know how to change the estimate statement to reflect this. Any ideas?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried adding a comma between &amp;amp;ref/&amp;amp;value and 1/2 and then tried switching the interaction term from sex*bmi to bmi*sex, but no luck. (By the way, if you have any resources on coding with the estimate statement with the square brackets, please let me know!)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks again for all your help!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Edit:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Nevermind! Just found some SAS resources on non-positional syntax &lt;A href="https://support.sas.com/documentation/onlinedoc/stat/131/introcom.pdf" target="_self"&gt;(p.455)&lt;/A&gt; and figured out that it should be&lt;/P&gt;&lt;PRE&gt;bmis*sex[-1, &lt;STRONG&gt;1&lt;/STRONG&gt; &amp;amp;ref.][1, &lt;STRONG&gt;1&lt;/STRONG&gt; &amp;amp;value.] &lt;/PRE&gt;&lt;P&gt;and not&lt;/P&gt;&lt;PRE&gt;bmis*sex[-1, &amp;amp;ref. &lt;STRONG&gt;1&lt;/STRONG&gt;][1, &amp;amp;value. &lt;STRONG&gt;1&lt;/STRONG&gt;] &lt;/PRE&gt;&lt;P&gt;(and so on for 2) because of the order of my variables. It works now. Thanks!&lt;/P&gt;</description>
      <pubDate>Thu, 24 Dec 2020 23:56:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/How-do-I-plot-the-spline-effect-in-PHREG/m-p/708154#M2325</guid>
      <dc:creator>sseb</dc:creator>
      <dc:date>2020-12-24T23:56:57Z</dc:date>
    </item>
    <item>
      <title>Re: How do I plot the spline effect in PHREG?</title>
      <link>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/How-do-I-plot-the-spline-effect-in-PHREG/m-p/769697#M2612</link>
      <description>&lt;P&gt;Hi there,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am a student using SAS for a project. I used the macro code you listed here to try to draw a cubic spline curve for cox model with multiple covariates adjusted. For unknown reasons, it didn't work and showed the following error. The file "estimates" was correctly generated and can be opened. Could you help with troubleshooting, please? Thank you very much!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;"94 ods html select none;&lt;/FONT&gt;&lt;/P&gt;&lt;DIV class="sasError focus-line"&gt;&lt;FONT color="#0000FF"&gt;ERROR: The HTML destination is not active; no select/exclude lists are available.&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;&lt;FONT color="#0000FF"&gt;95&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;&lt;FONT color="#0000FF"&gt;96 ods rtf select none;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV class="sasError"&gt;&lt;FONT color="#0000FF"&gt;ERROR: The RTF destination is not active; no select/exclude lists are available.&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;&lt;FONT color="#0000FF"&gt;97&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;&lt;FONT color="#0000FF"&gt;.......&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;&lt;FONT color="#0000FF"&gt;108 ods html select all;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV class="sasError focus-line"&gt;&lt;FONT color="#0000FF"&gt;ERROR: The HTML destination is not active; no select/exclude lists are available.&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;&lt;FONT color="#0000FF"&gt;109&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;&lt;FONT color="#0000FF"&gt;110 ods rtf select all;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV class="sasError"&gt;&lt;FONT color="#0000FF"&gt;ERROR: The RTF destination is not active; no select/exclude lists are available.".&lt;/FONT&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;******here are the codes I used ***********&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;ods graphics on;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;PROC PHREG DATA = BB.omega3_cvd ; /* or other plots */&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#000000"&gt;effect spl = spline(diet_avg / basis=tpf(noint) NATURALCUBIC details knotmethod=rangefractions(1, 1.4, 2.0) );&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#000000"&gt;model PERMTH_INT*MORTSTAT(0) = spl RIDAGEYR RIAGENDR RIDRETH1 DMDEDUC2 DMDMARTL PIR dietenergyavg active &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#000000"&gt;smokestatus drinkstatus SDDSRVYR BMXBMI / rl=wald ties=EFRON ;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#000000"&gt;store BB.coxr;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#000000"&gt;run;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;%macro est(ref=1.4, start=0, end=20, by=0.1);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;%Do i = 1 %To %eval(%SysFunc( Ceil( %SysEvalF( ( &amp;amp;End - &amp;amp;Start ) / &amp;amp;By ) ) ) +1) ;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;%Let value=%SysEvalF( ( &amp;amp;Start - &amp;amp;By ) + ( &amp;amp;By * &amp;amp;I ) ) ;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;estimate "&amp;amp;value." spl [-1, &amp;amp;ref] [1, &amp;amp;value] / exp cl;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;%end;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;%mend est;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;FONT color="#000000"&gt;ods html select none;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;ods rtf select none;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;ods dataset Estimates=Estimates;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;FONT color="#000000"&gt;proc plm restore=BB.coxr;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;%est(ref=1.4, start=0, end=20, by=0.1);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;run;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;FONT color="#000000"&gt;ods html select all;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;ods rtf select all;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;data estimates;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;set estimates;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;diet_avg=label*1;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;run;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;proc sgplot data=estimates NOAUTOLEGEND Noborder;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;Series y=ExpEstimate x=diet_avg / ;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;Series y=LowerExp x=diet_avg / LINEATTRS=(pattern=ShortDash color=Black THICKNESS=1);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;Series y=UpperExp x=diet_avg / LINEATTRS=(pattern=ShortDash color=Black THICKNESS=1);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;REFLINE 1 / axis=y;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;REFLINE 1.4 / Axis=X LINEATTRS=(pattern=ThinDot color=Black THICKNESS=1);;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;yaxis Values=(0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2 3 4) Label="Hazard ratio" Type=LOG LABELATTRS=(weight=BOLD);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;xaxis min=0 VALUES=(0 to 20 by 1) LABELATTRS=(weight=BOLD);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;run;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Sep 2021 19:49:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/How-do-I-plot-the-spline-effect-in-PHREG/m-p/769697#M2612</guid>
      <dc:creator>maomao0803</dc:creator>
      <dc:date>2021-09-22T19:49:36Z</dc:date>
    </item>
    <item>
      <title>Re: How do I plot the spline effect in PHREG?</title>
      <link>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/How-do-I-plot-the-spline-effect-in-PHREG/m-p/872953#M2683</link>
      <description>&lt;P&gt;I have the same question! Did you ever figure out how to plot splines with PROC SURVEYPHREG?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;Sophie&lt;/P&gt;</description>
      <pubDate>Sat, 29 Apr 2023 01:44:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/How-do-I-plot-the-spline-effect-in-PHREG/m-p/872953#M2683</guid>
      <dc:creator>sophiec</dc:creator>
      <dc:date>2023-04-29T01:44:26Z</dc:date>
    </item>
    <item>
      <title>Re: How do I plot the spline effect in PHREG?</title>
      <link>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/How-do-I-plot-the-spline-effect-in-PHREG/m-p/888516#M2694</link>
      <description>&lt;P&gt;This is a great program. Thank you!&lt;/P&gt;</description>
      <pubDate>Wed, 09 Aug 2023 08:25:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/How-do-I-plot-the-spline-effect-in-PHREG/m-p/888516#M2694</guid>
      <dc:creator>HenrikLJ</dc:creator>
      <dc:date>2023-08-09T08:25:24Z</dc:date>
    </item>
  </channel>
</rss>

