<?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: different refline by group in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/different-refline-by-group/m-p/562261#M18210</link>
    <description>&lt;P&gt;Here's one way to do it, by adding some extra obsns to the dataset ...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sql noprint;&lt;BR /&gt;create table avg_data as&lt;BR /&gt;select unique sex, avg(height) as avg_height&lt;BR /&gt;from my_data&lt;BR /&gt;group by sex;&lt;BR /&gt;quit; run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data my_data; set sashelp.class avg_data;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sort data=my_data out=my_data;&lt;BR /&gt;by sex;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;title "Class Data";&lt;BR /&gt;proc sgplot data=my_data uniform=scale;&lt;BR /&gt;by sex;&lt;BR /&gt;scatter y=height x=weight;&lt;BR /&gt;refline avg_height / label;&lt;BR /&gt;run;&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="female.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/29846i99A1C4284091868B/image-size/large?v=v2&amp;amp;px=999" role="button" title="female.png" alt="female.png" /&gt;&lt;/span&gt;&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="male.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/29847i7AB6F44BACFFA3D4/image-size/large?v=v2&amp;amp;px=999" role="button" title="male.png" alt="male.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 29 May 2019 13:24:00 GMT</pubDate>
    <dc:creator>GraphGuy</dc:creator>
    <dc:date>2019-05-29T13:24:00Z</dc:date>
    <item>
      <title>different refline by group</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/different-refline-by-group/m-p/562200#M18209</link>
      <description>&lt;P&gt;Is there a way to dynamically change the reference line by group? I know the BY command to draw a graph for each group but what about in each of those graphs, we have a different refline too?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 May 2019 09:13:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/different-refline-by-group/m-p/562200#M18209</guid>
      <dc:creator>somebody</dc:creator>
      <dc:date>2019-05-29T09:13:57Z</dc:date>
    </item>
    <item>
      <title>Re: different refline by group</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/different-refline-by-group/m-p/562261#M18210</link>
      <description>&lt;P&gt;Here's one way to do it, by adding some extra obsns to the dataset ...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sql noprint;&lt;BR /&gt;create table avg_data as&lt;BR /&gt;select unique sex, avg(height) as avg_height&lt;BR /&gt;from my_data&lt;BR /&gt;group by sex;&lt;BR /&gt;quit; run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data my_data; set sashelp.class avg_data;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sort data=my_data out=my_data;&lt;BR /&gt;by sex;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;title "Class Data";&lt;BR /&gt;proc sgplot data=my_data uniform=scale;&lt;BR /&gt;by sex;&lt;BR /&gt;scatter y=height x=weight;&lt;BR /&gt;refline avg_height / label;&lt;BR /&gt;run;&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="female.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/29846i99A1C4284091868B/image-size/large?v=v2&amp;amp;px=999" role="button" title="female.png" alt="female.png" /&gt;&lt;/span&gt;&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="male.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/29847i7AB6F44BACFFA3D4/image-size/large?v=v2&amp;amp;px=999" role="button" title="male.png" alt="male.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 May 2019 13:24:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/different-refline-by-group/m-p/562261#M18210</guid>
      <dc:creator>GraphGuy</dc:creator>
      <dc:date>2019-05-29T13:24:00Z</dc:date>
    </item>
    <item>
      <title>Re: different refline by group</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/different-refline-by-group/m-p/562752#M18222</link>
      <description>&lt;P&gt;thanks. This works very well, except that I have 2 reflines which are dates. Instead of date, I would want to label it 'IN' and 'OUT' for the first and second refline, respectively. How could I achieve this? I tried this code but it does not work:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sgplot data=Sp500_in_out_sample2;
	by stock;
	series x=date y=price;
	refline date_in / axis=x label='in';
	refline date_out/ axis=x label='out';
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 31 May 2019 02:07:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/different-refline-by-group/m-p/562752#M18222</guid>
      <dc:creator>somebody</dc:creator>
      <dc:date>2019-05-31T02:07:09Z</dc:date>
    </item>
    <item>
      <title>Re: different refline by group</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/different-refline-by-group/m-p/562763#M18223</link>
      <description>&lt;P&gt;When you use variable-based REFLINEs, the LABELs must also be variable-based. Just create additional columns containing your "in" and "out" labels (e.g. inlabel and outlabel), and do the following:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sgplot data=Sp500_in_out_sample2;
	by stock;
	series x=date y=price;
	refline date_in / axis=x label=inlabel;
	refline date_out/ axis=x label=outlabel;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Hope this helps!&lt;/P&gt;
&lt;P&gt;Dan&lt;/P&gt;</description>
      <pubDate>Fri, 31 May 2019 04:18:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/different-refline-by-group/m-p/562763#M18223</guid>
      <dc:creator>DanH_sas</dc:creator>
      <dc:date>2019-05-31T04:18:05Z</dc:date>
    </item>
  </channel>
</rss>

