<?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: sgplot : scatter plot with connected mean in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/sgplot-scatter-plot-with-connected-mean/m-p/670307#M20237</link>
    <description>Hello FreelanceReinhard AMETHYS,&lt;BR /&gt;Thank You so much for very cool codes.&lt;BR /&gt;Bests,&lt;BR /&gt;Golf.</description>
    <pubDate>Sat, 18 Jul 2020 14:01:05 GMT</pubDate>
    <dc:creator>Golf</dc:creator>
    <dc:date>2020-07-18T14:01:05Z</dc:date>
    <item>
      <title>sgplot : scatter plot with connected mean</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/sgplot-scatter-plot-with-connected-mean/m-p/670254#M20235</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp; I have two variables&amp;nbsp; pref_hat and BrewingTime (2 mins, 4 mins, 6mins and 8mins).&amp;nbsp; &amp;nbsp;I used the following procedure:&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sgplot data = conjoint;&lt;BR /&gt;scatter y=pref_hat x=BrewingTime;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; How can I connect the mean of pref_hat in each of BrewingTime in the scatter plot below?&lt;/P&gt;
&lt;P&gt;Bests,&lt;/P&gt;
&lt;P&gt;Golf&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Golf_0-1595045097283.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/47269iB0800FF5D23A55BD/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Golf_0-1595045097283.png" alt="Golf_0-1595045097283.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 18 Jul 2020 04:06:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/sgplot-scatter-plot-with-connected-mean/m-p/670254#M20235</guid>
      <dc:creator>Golf</dc:creator>
      <dc:date>2020-07-18T04:06:25Z</dc:date>
    </item>
    <item>
      <title>Re: sgplot : scatter plot with connected mean</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/sgplot-scatter-plot-with-connected-mean/m-p/670289#M20236</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/313878"&gt;@Golf&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would combine the scatter plot with a line plot using precomputed mean values:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* Create test data for demonstration */

data conjoint(drop=b);
length BrewingTime $8;
do _n_=1 to 9;
  pref_hat=0.3+0.4*rannor(1425674559);
  do b=2 to 8 by 2;
    pref_hat=pref_hat+b/18-b**2/65;
    BrewingTime=catx(' ',b,'Mins');
    output;
  end;
end;
run;

/* Compute mean values */

proc summary data=conjoint nway;
class BrewingTime;
var pref_hat;
output out=stats mean=mean_pref_hat;
run;

/* Append mean values to detail data */

data want;
set conjoint stats;
run;

/* Combine scatter plot with line plot */

proc sgplot data=want;
scatter y=pref_hat      x=BrewingTime;
series  y=mean_pref_hat x=BrewingTime / markers markerattrs=(symbol=X);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Result:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="overlay_plot.png" style="width: 640px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/47274i91F9C9E82F2B7A8C/image-size/large?v=v2&amp;amp;px=999" role="button" title="overlay_plot.png" alt="overlay_plot.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 18 Jul 2020 10:52:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/sgplot-scatter-plot-with-connected-mean/m-p/670289#M20236</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2020-07-18T10:52:15Z</dc:date>
    </item>
    <item>
      <title>Re: sgplot : scatter plot with connected mean</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/sgplot-scatter-plot-with-connected-mean/m-p/670307#M20237</link>
      <description>Hello FreelanceReinhard AMETHYS,&lt;BR /&gt;Thank You so much for very cool codes.&lt;BR /&gt;Bests,&lt;BR /&gt;Golf.</description>
      <pubDate>Sat, 18 Jul 2020 14:01:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/sgplot-scatter-plot-with-connected-mean/m-p/670307#M20237</guid>
      <dc:creator>Golf</dc:creator>
      <dc:date>2020-07-18T14:01:05Z</dc:date>
    </item>
  </channel>
</rss>

