<?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: Fit multiple loess lines on plot? in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Fit-multiple-loess-lines-on-plot/m-p/520497#M4037</link>
    <description>&lt;P&gt;Use BY processing and SGPLOT. Example:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data=sashelp.heart out=heart; by sex height; run;

proc loess data=heart plots=none;
by sex;
model weight = height / interp=linear degree=1;
output out=smooth predicted=smWeight;
run;

proc sgplot data=smooth;
where ageAtStart between 60 and 65;
scatter x=height y=weight / group=sex markerattrs=(symbol=circle);
series x=height y=smWeight / group=sex lineattrs=(pattern=solid);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SGPlot3.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/25565iA7B4D56E5B817406/image-size/large?v=v2&amp;amp;px=999" role="button" title="SGPlot3.png" alt="SGPlot3.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 11 Dec 2018 19:05:50 GMT</pubDate>
    <dc:creator>PGStats</dc:creator>
    <dc:date>2018-12-11T19:05:50Z</dc:date>
    <item>
      <title>Fit multiple loess lines on plot?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Fit-multiple-loess-lines-on-plot/m-p/520447#M4029</link>
      <description>&lt;P&gt;Dear SAS users,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using SAS Enterprise Guide to look at the relationship between online patient portal use (continuous; X) and age (continuous; Y), and whether this relationship differs by dichotomous variable region (M; categorical; rural or urban).This patient portal data (X) is not normally distributed, so I am trying to fit a loess curve. I would like to overlay 1 loess curve for rural and one curve for urban on the same graph. My data are set up as such:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PortalUse        Region        Age
3                Rural         45
7                Urban         67
2                Urban         83
etc...&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Right now, I have only figured out how to plot separate loess curves (one plot for rural, one for urban) with the following syntax:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE class="sas"&gt;ods graphics &lt;SPAN&gt;on&lt;/SPAN&gt;;
ods &lt;SPAN&gt;select&lt;/SPAN&gt; FitPlot;
&lt;SPAN&gt;proc loess&lt;/SPAN&gt; &lt;SPAN&gt;data&lt;/SPAN&gt;=LoessData plots=FitPlot;
by region;&lt;BR /&gt;model Age = PortalUse / interp=linear         
              degree=&lt;SPAN&gt;1&lt;/SPAN&gt;               
              &lt;SPAN&gt;select&lt;/SPAN&gt;=AICC&lt;SPAN&gt;(&lt;/SPAN&gt;presearch&lt;SPAN&gt;)&lt;/SPAN&gt;;
&lt;SPAN&gt;run&lt;/SPAN&gt;;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;Is there a way to graph these two loess curves on the same plot? ideally, it would look&amp;nbsp; something like this (with obvious differences in the x and y axes labels):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;IMG src="http://4.bp.blogspot.com/_zct02J1FROM/Ri3t6A_cEEI/AAAAAAAAAAc/v3fwxq-dyD8/s400/multipleonone.gif" border="0" alt="Image result for multiple lines one loess graph" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you in advance for your expertise and time.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Stephanie&lt;/P&gt;</description>
      <pubDate>Tue, 11 Dec 2018 17:15:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Fit-multiple-loess-lines-on-plot/m-p/520447#M4029</guid>
      <dc:creator>sarobinson010</dc:creator>
      <dc:date>2018-12-11T17:15:43Z</dc:date>
    </item>
    <item>
      <title>Re: Fit multiple loess lines on plot?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Fit-multiple-loess-lines-on-plot/m-p/520470#M4030</link>
      <description>&lt;P&gt;Easily done via PROC SGPLOT.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Use two LOESS commands in your PROC SGPLOT.&lt;/P&gt;</description>
      <pubDate>Tue, 11 Dec 2018 17:56:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Fit-multiple-loess-lines-on-plot/m-p/520470#M4030</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2018-12-11T17:56:05Z</dc:date>
    </item>
    <item>
      <title>Re: Fit multiple loess lines on plot?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Fit-multiple-loess-lines-on-plot/m-p/520497#M4037</link>
      <description>&lt;P&gt;Use BY processing and SGPLOT. Example:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data=sashelp.heart out=heart; by sex height; run;

proc loess data=heart plots=none;
by sex;
model weight = height / interp=linear degree=1;
output out=smooth predicted=smWeight;
run;

proc sgplot data=smooth;
where ageAtStart between 60 and 65;
scatter x=height y=weight / group=sex markerattrs=(symbol=circle);
series x=height y=smWeight / group=sex lineattrs=(pattern=solid);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SGPlot3.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/25565iA7B4D56E5B817406/image-size/large?v=v2&amp;amp;px=999" role="button" title="SGPlot3.png" alt="SGPlot3.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Dec 2018 19:05:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Fit-multiple-loess-lines-on-plot/m-p/520497#M4037</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2018-12-11T19:05:50Z</dc:date>
    </item>
    <item>
      <title>Re: Fit multiple loess lines on plot?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Fit-multiple-loess-lines-on-plot/m-p/520517#M4041</link>
      <description>&lt;P&gt;Yes,&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/462"&gt;@PGStats&lt;/a&gt;, that fits better than my answer above.&lt;/P&gt;</description>
      <pubDate>Tue, 11 Dec 2018 20:00:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Fit-multiple-loess-lines-on-plot/m-p/520517#M4041</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2018-12-11T20:00:30Z</dc:date>
    </item>
  </channel>
</rss>

