<?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: SG Annotation with BY Variables in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/SG-Annotation-with-BY-Variables/m-p/926928#M24586</link>
    <description>&lt;P&gt;A better workaround for you would be to use a VECTOR plot. I would create the data for the vector plot in a separate dataset and match-merge that with the original data. Set the GROUP on the vector plot to be the same as the BY-group variable, and then you'll be able to control the arrow attributes from &amp;nbsp;discrete attrmap.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this helps!&lt;/P&gt;</description>
    <pubDate>Fri, 03 May 2024 17:31:26 GMT</pubDate>
    <dc:creator>DanH_sas</dc:creator>
    <dc:date>2024-05-03T17:31:26Z</dc:date>
    <item>
      <title>SG Annotation with BY Variables</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/SG-Annotation-with-BY-Variables/m-p/926917#M24583</link>
      <description>&lt;P&gt;I am trying to perform SG Annotation with BY Variables. In this trivial example, I want one plot with a red arrow for the plot of Male data; and one plot for the females with a green arrow, depending on the value of SEX in SASHELP.CLASS&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's my code that doesn't work (stealing from the example &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.4/grstatproc/n0eben23mwnl3dn1cm95zbks0eea.htm#p0462bjuifkodon1evuqv5fwe1k2" target="_self"&gt;here&lt;/A&gt;).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%sganno                                       
data sgannodata;  
  set sashelp.class(obs=2);  
  if sex='M' then do;
      %sgarrow(x1=51, x2=30, y1=30, y2=30, linecolor="red")
  end;
  else if sex='F' then do;
       %sgarrow(x1=51, x2=30, y1=30, y2=35, linecolor="green")
  end;
  keep sex; 
run;
proc sort data=sashelp.class out=class;
    by descending sex ;
run;
proc sgplot data=class sganno=sgannodata;     
  scatter x=age y=weight;
  by descending sex;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's the incorrect output (the correct output would be the red arrow on the males and the green arrow on the females, not both arrows on both plots)&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="PaigeMiller_1-1714751178909.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/96150iE02B6D7D7801DFDB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="PaigeMiller_1-1714751178909.png" alt="PaigeMiller_1-1714751178909.png" /&gt;&lt;/span&gt;&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;
&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>Fri, 03 May 2024 15:46:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/SG-Annotation-with-BY-Variables/m-p/926917#M24583</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2024-05-03T15:46:51Z</dc:date>
    </item>
    <item>
      <title>Re: SG Annotation with BY Variables</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/SG-Annotation-with-BY-Variables/m-p/926924#M24584</link>
      <description>&lt;P&gt;Unfortunately, we do not currently support BY-grouping annotation. I would recommend calling Technical Support and have them add a request for this feature. In the meantime, there might be some workarounds to get what you need. Can you elaborate on your specific annotation requirement?&lt;/P&gt;</description>
      <pubDate>Fri, 03 May 2024 17:12:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/SG-Annotation-with-BY-Variables/m-p/926924#M24584</guid>
      <dc:creator>DanH_sas</dc:creator>
      <dc:date>2024-05-03T17:12:24Z</dc:date>
    </item>
    <item>
      <title>Re: SG Annotation with BY Variables</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/SG-Annotation-with-BY-Variables/m-p/926926#M24585</link>
      <description>&lt;P&gt;Thanks,&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/15130"&gt;@DanH_sas&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My real problem isn't really that much different from the above, I have two groups, and on each plot I want arrows appropriate for that group based on the data for that group. I can always write a macro loop as the work-around. I will contact Technical Support as you suggested.&lt;/P&gt;</description>
      <pubDate>Fri, 03 May 2024 17:25:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/SG-Annotation-with-BY-Variables/m-p/926926#M24585</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2024-05-03T17:25:32Z</dc:date>
    </item>
    <item>
      <title>Re: SG Annotation with BY Variables</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/SG-Annotation-with-BY-Variables/m-p/926928#M24586</link>
      <description>&lt;P&gt;A better workaround for you would be to use a VECTOR plot. I would create the data for the vector plot in a separate dataset and match-merge that with the original data. Set the GROUP on the vector plot to be the same as the BY-group variable, and then you'll be able to control the arrow attributes from &amp;nbsp;discrete attrmap.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this helps!&lt;/P&gt;</description>
      <pubDate>Fri, 03 May 2024 17:31:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/SG-Annotation-with-BY-Variables/m-p/926928#M24586</guid>
      <dc:creator>DanH_sas</dc:creator>
      <dc:date>2024-05-03T17:31:26Z</dc:date>
    </item>
    <item>
      <title>Re: SG Annotation with BY Variables</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/SG-Annotation-with-BY-Variables/m-p/926990#M24591</link>
      <description>&lt;P&gt;I have never used a VECTOR plot, but I looked the documentation at&amp;nbsp;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.4/grstatproc/n19gxtzyuf79t3n16g5v26b73ckv.htm#p10cmevi5jmuyen13p1r48g4f45y" target="_blank" rel="noopener"&gt;https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.4/grstatproc/n19gxtzyuf79t3n16g5v26b73ckv.htm#p10cmevi5jmuyen13p1r48g4f45y&lt;/A&gt; and it does not seem like it fits my use case.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want a number of arrows on each plot, they do not all start from the same origin (which seems like VECTOR plots require). The data determines the start point and end point of each arrow on a plot, the start points on each plot do not have to match and the end points on each plot do not have to match.&lt;/P&gt;</description>
      <pubDate>Sat, 04 May 2024 10:32:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/SG-Annotation-with-BY-Variables/m-p/926990#M24591</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2024-05-04T10:32:48Z</dc:date>
    </item>
    <item>
      <title>Re: SG Annotation with BY Variables</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/SG-Annotation-with-BY-Variables/m-p/927012#M24592</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I have never used a VECTOR plot, but I looked the documentation at&amp;nbsp;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.4/grstatproc/n19gxtzyuf79t3n16g5v26b73ckv.htm#p10cmevi5jmuyen13p1r48g4f45y" target="_blank" rel="noopener"&gt;https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.4/grstatproc/n19gxtzyuf79t3n16g5v26b73ckv.htm#p10cmevi5jmuyen13p1r48g4f45y&lt;/A&gt; and it does not seem like it fits my use case.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want a number of arrows on each plot, they do not all start from the same origin (which seems like VECTOR plots require). The data determines the start point and end point of each arrow on a plot, the start points on each plot do not have to match and the end points on each plot do not have to match.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I think you would be wanting the XORIGIN=variable and YORIGIN=variable to modify the origin of each vector.&lt;/P&gt;
&lt;P&gt;So if you can supply an (Xorigin,Yorigin) coordinate for the start and the (X,Y) coordinate for the end of the vector you're golden.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There is an example of using these options in a Vector plot at &lt;A href="https://support.sas.com/kb/39/078.html" target="_blank" rel="noopener"&gt;https://support.sas.com/kb/39/078.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 05 May 2024 04:25:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/SG-Annotation-with-BY-Variables/m-p/927012#M24592</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2024-05-05T04:25:25Z</dc:date>
    </item>
    <item>
      <title>Re: SG Annotation with BY Variables</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/SG-Annotation-with-BY-Variables/m-p/927034#M24593</link>
      <description>&lt;P&gt;Thanks! I will give it a try on Monday&lt;/P&gt;</description>
      <pubDate>Sat, 04 May 2024 15:44:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/SG-Annotation-with-BY-Variables/m-p/927034#M24593</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2024-05-04T15:44:26Z</dc:date>
    </item>
    <item>
      <title>Re: SG Annotation with BY Variables</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/SG-Annotation-with-BY-Variables/m-p/927076#M24596</link>
      <description>&lt;P&gt;Paige,&lt;/P&gt;
&lt;P&gt;I think you used wrong tool .&lt;/P&gt;
&lt;P&gt;If you want change the color of LINE or MARKERS ... ,you need use DATTRMAP= function.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data dattrmap;
input id $ value $ linecolor $ ;
cards;
id F green 
id M red  
;
run;



proc sort data=sashelp.class out=class;
    by descending sex ;
run;
data class;
 set class;
 by descending sex;
 if first.sex and sex='F' then do; x1=51; x2=30; y1=30; y2=35;end;
 if first.sex and sex='M' then do; x1=51; x2=30; y1=30; y2=30;end;
run;
proc sgplot data=class dattrmap=dattrmap;     
  scatter x=age y=weight;
  vector x=x2 y=y2/xorigin=x1 xorigin=y1 group=sex attrid=id;
  by descending sex;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 05 May 2024 08:15:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/SG-Annotation-with-BY-Variables/m-p/927076#M24596</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2024-05-05T08:15:59Z</dc:date>
    </item>
    <item>
      <title>Re: SG Annotation with BY Variables</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/SG-Annotation-with-BY-Variables/m-p/927080#M24597</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ksharp_1-1714897166507.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/96187i5050CD0E9F68F372/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ksharp_1-1714897166507.png" alt="Ksharp_1-1714897166507.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="Ksharp_2-1714897175516.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/96188i9AC0638B56F59388/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ksharp_2-1714897175516.png" alt="Ksharp_2-1714897175516.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 05 May 2024 08:19:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/SG-Annotation-with-BY-Variables/m-p/927080#M24597</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2024-05-05T08:19:45Z</dc:date>
    </item>
  </channel>
</rss>

