<?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 add a mean or median smooth line to Spagetti plot? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-add-a-mean-or-median-smooth-line-to-Spagetti-plot/m-p/641347#M191125</link>
    <description>&lt;P&gt;Mean or median of what exactly?&lt;/P&gt;
&lt;P&gt;How many lines of spaghetti (group=ID values) are there? If you have 10 lines are you looking to add 10 "means"?&lt;/P&gt;
&lt;P&gt;You&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I might be tempted to add:&lt;/P&gt;
&lt;P&gt;reg x=year y=eGFR_a /group=ID ;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;to show a "best fit" line associated for each group.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or summarize you data to find the desired mean or median and use a REFLINE statement to plot those values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 20 Apr 2020 15:18:12 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2020-04-20T15:18:12Z</dc:date>
    <item>
      <title>How to add a mean or median smooth line to Spagetti plot?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-add-a-mean-or-median-smooth-line-to-Spagetti-plot/m-p/641032#M191016</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Attached is the spagetti plot that I made. Does anyone know how to add a smooth line (mean or median) to this figure?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below is my SAS code:&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;proc sgplot data=test2;&lt;BR /&gt;where AKI=1 &amp;amp; survive_5yr = 1;&lt;BR /&gt;series x=year y=eGFR_a /group=ID ;&lt;BR /&gt;keylegend 'grouping' / type=linecolor;&lt;BR /&gt;label eGFR_a = eGFR year = Year;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many thanks in advance!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 19 Apr 2020 01:21:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-add-a-mean-or-median-smooth-line-to-Spagetti-plot/m-p/641032#M191016</guid>
      <dc:creator>Denali</dc:creator>
      <dc:date>2020-04-19T01:21:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to add a mean or median smooth line to Spagetti plot?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-add-a-mean-or-median-smooth-line-to-Spagetti-plot/m-p/641039#M191019</link>
      <description>&lt;P&gt;1. Do not attach MS Office files, many will/can not download these.&lt;/P&gt;
&lt;P&gt;2. Include images as ... images, there's a button for that&lt;/P&gt;
&lt;P&gt;3. Did you try adding a series statement?&lt;/P&gt;
&lt;P&gt;4. It's a good idea to include code that we can run. For example using one of the sample data sets in the SASHELP library.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 19 Apr 2020 03:54:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-add-a-mean-or-median-smooth-line-to-Spagetti-plot/m-p/641039#M191019</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2020-04-19T03:54:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to add a mean or median smooth line to Spagetti plot?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-add-a-mean-or-median-smooth-line-to-Spagetti-plot/m-p/641042#M191022</link>
      <description>Sorry, I didn’t see the imagine button. Where is it?&lt;BR /&gt;What series can I add for the smooth line? I would like to add a mean or median into the plot.</description>
      <pubDate>Sun, 19 Apr 2020 05:01:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-add-a-mean-or-median-smooth-line-to-Spagetti-plot/m-p/641042#M191022</guid>
      <dc:creator>Denali</dc:creator>
      <dc:date>2020-04-19T05:01:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to add a mean or median smooth line to Spagetti plot?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-add-a-mean-or-median-smooth-line-to-Spagetti-plot/m-p/641051#M191027</link>
      <description>1. The camera button&lt;BR /&gt;2. Calculate the mean and plot it&lt;BR /&gt;</description>
      <pubDate>Sun, 19 Apr 2020 07:15:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-add-a-mean-or-median-smooth-line-to-Spagetti-plot/m-p/641051#M191027</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2020-04-19T07:15:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to add a mean or median smooth line to Spagetti plot?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-add-a-mean-or-median-smooth-line-to-Spagetti-plot/m-p/641064#M191032</link>
      <description>Maybe it is not what you want.But could try LOESS &lt;BR /&gt;&lt;BR /&gt;loess x=year y=eGFR_a ;</description>
      <pubDate>Sun, 19 Apr 2020 10:11:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-add-a-mean-or-median-smooth-line-to-Spagetti-plot/m-p/641064#M191032</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2020-04-19T10:11:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to add a mean or median smooth line to Spagetti plot?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-add-a-mean-or-median-smooth-line-to-Spagetti-plot/m-p/641065#M191033</link>
      <description>Or try quantile regression PROC QUANTREG:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://blogs.sas.com/content/iml/2018/08/13/quantile-regression-chess-ratings.html" target="_blank"&gt;https://blogs.sas.com/content/iml/2018/08/13/quantile-regression-chess-ratings.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://blogs.sas.com/content/iml/2018/08/06/score-quantile-regression-sas.html" target="_blank"&gt;https://blogs.sas.com/content/iml/2018/08/06/score-quantile-regression-sas.html&lt;/A&gt;</description>
      <pubDate>Sun, 19 Apr 2020 10:17:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-add-a-mean-or-median-smooth-line-to-Spagetti-plot/m-p/641065#M191033</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2020-04-19T10:17:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to add a mean or median smooth line to Spagetti plot?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-add-a-mean-or-median-smooth-line-to-Spagetti-plot/m-p/641347#M191125</link>
      <description>&lt;P&gt;Mean or median of what exactly?&lt;/P&gt;
&lt;P&gt;How many lines of spaghetti (group=ID values) are there? If you have 10 lines are you looking to add 10 "means"?&lt;/P&gt;
&lt;P&gt;You&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I might be tempted to add:&lt;/P&gt;
&lt;P&gt;reg x=year y=eGFR_a /group=ID ;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;to show a "best fit" line associated for each group.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or summarize you data to find the desired mean or median and use a REFLINE statement to plot those values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 20 Apr 2020 15:18:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-add-a-mean-or-median-smooth-line-to-Spagetti-plot/m-p/641347#M191125</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-04-20T15:18:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to add a mean or median smooth line to Spagetti plot?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-add-a-mean-or-median-smooth-line-to-Spagetti-plot/m-p/644908#M192721</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SGPlot.png" style="width: 640px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/39018i5146A911730A9779/image-size/large?v=v2&amp;amp;px=999" role="button" title="SGPlot.png" alt="SGPlot.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;proc sgplot data=test2;&lt;BR /&gt;where AKI=1 &amp;amp; survive_5yr = 1;&lt;BR /&gt;series x=year y=eGFR_a /group=ID ;&lt;BR /&gt;loess x=year y=eGFR_a ;&lt;BR /&gt;keylegend 'grouping' / type=linecolor;&lt;BR /&gt;label eGFR_a = eGFR year = Year;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It does not look like what I expected. I would like to plot a mean in the middle of the figure, if possible....&lt;/P&gt;</description>
      <pubDate>Mon, 04 May 2020 04:27:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-add-a-mean-or-median-smooth-line-to-Spagetti-plot/m-p/644908#M192721</guid>
      <dc:creator>Denali</dc:creator>
      <dc:date>2020-05-04T04:27:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to add a mean or median smooth line to Spagetti plot?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-add-a-mean-or-median-smooth-line-to-Spagetti-plot/m-p/644958#M192729</link>
      <description>Well. Could you calculate mean of eGFR_a within a year .And plot it on your own ?</description>
      <pubDate>Mon, 04 May 2020 11:36:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-add-a-mean-or-median-smooth-line-to-Spagetti-plot/m-p/644958#M192729</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2020-05-04T11:36:50Z</dc:date>
    </item>
  </channel>
</rss>

