<?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 Swimmer Plot Some Arrows Negative in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/Swimmer-Plot-Some-Arrows-Negative/m-p/944162#M25045</link>
    <description>&lt;P&gt;I'm trying to make something like a swimmer plot, but some of the arrows go in the negative direction. HighLow cannot be used this way correct? What are my options? In this case I have a baseline score and sometimes the score declines so the arrow will point in the negative direction while most are positive.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Y-axis variable = Subject Identifier&lt;/P&gt;
&lt;P&gt;X-axis variable = 2 score columns one with the baseline value and one with the value at the target timepoint.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As a further wrinkle, I would like to place a reference line between groups of subjects on the y-axis.&lt;/P&gt;</description>
    <pubDate>Mon, 16 Sep 2024 21:55:46 GMT</pubDate>
    <dc:creator>_Hopper</dc:creator>
    <dc:date>2024-09-16T21:55:46Z</dc:date>
    <item>
      <title>Swimmer Plot Some Arrows Negative</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Swimmer-Plot-Some-Arrows-Negative/m-p/944162#M25045</link>
      <description>&lt;P&gt;I'm trying to make something like a swimmer plot, but some of the arrows go in the negative direction. HighLow cannot be used this way correct? What are my options? In this case I have a baseline score and sometimes the score declines so the arrow will point in the negative direction while most are positive.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Y-axis variable = Subject Identifier&lt;/P&gt;
&lt;P&gt;X-axis variable = 2 score columns one with the baseline value and one with the value at the target timepoint.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As a further wrinkle, I would like to place a reference line between groups of subjects on the y-axis.&lt;/P&gt;</description>
      <pubDate>Mon, 16 Sep 2024 21:55:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Swimmer-Plot-Some-Arrows-Negative/m-p/944162#M25045</guid>
      <dc:creator>_Hopper</dc:creator>
      <dc:date>2024-09-16T21:55:46Z</dc:date>
    </item>
    <item>
      <title>Re: Swimmer Plot Some Arrows Negative</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Swimmer-Plot-Some-Arrows-Negative/m-p/944163#M25046</link>
      <description>&lt;P&gt;Data is helpful if you want working code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A Vector plot should work.&lt;/P&gt;
&lt;P&gt;The x=value and y=subject values are the coordinates of the end of the plot. Add Xorigin (base), yorigin the same as y.&lt;/P&gt;
&lt;P&gt;Probably use Arrowdirection=out to have a point at the ending value.&lt;/P&gt;</description>
      <pubDate>Mon, 16 Sep 2024 22:00:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Swimmer-Plot-Some-Arrows-Negative/m-p/944163#M25046</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2024-09-16T22:00:50Z</dc:date>
    </item>
    <item>
      <title>Re: Swimmer Plot Some Arrows Negative</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Swimmer-Plot-Some-Arrows-Negative/m-p/944164#M25047</link>
      <description>&lt;P&gt;Data:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Subjid TRTAN BASE AVAL&lt;/P&gt;
&lt;P&gt;A1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 12&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;14&lt;/P&gt;
&lt;P&gt;A2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 10&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 8&lt;/P&gt;
&lt;P&gt;B1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 11&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 11&lt;/P&gt;
&lt;P&gt;B2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;10&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 13&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would like to have a divider between treatment groups on the y-axis if it's possible to do.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Sep 2024 22:14:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Swimmer-Plot-Some-Arrows-Negative/m-p/944164#M25047</guid>
      <dc:creator>_Hopper</dc:creator>
      <dc:date>2024-09-16T22:14:09Z</dc:date>
    </item>
    <item>
      <title>Re: Swimmer Plot Some Arrows Negative</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Swimmer-Plot-Some-Arrows-Negative/m-p/944165#M25048</link>
      <description>&lt;P&gt;What role does TRTAN play? Nothing was mentioned in the original post about this.&lt;/P&gt;
&lt;P&gt;Vector plots require numeric values. So this creates a value of the line number, then create a custom format to display the text of the subjid original value. That numeric requirement may make it much easier to place useful reference lines, maybe not. You didn't provide a description of how to separate the values so I made a guess. Refline can use variables in the data set for the line&amp;nbsp; location value and label text if you want many reference lines. So it might be that adding some additional variables would be useful.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You might use the TRTAN variable as a GROUP variable to indicate membership in a group, if that is the purpose, instead of a separation line.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data have;
   input Subjid $ TRTAN $ BASE AVAL;
   yval=_n_;
datalines;
A1            1            12         14
A2            1            10        8
B1           2            11          11
B2           2           10          13
;

proc format library=work;
value yval
1='A1' 
2='A2' 
3='B1' 
4='B2'
;
run;


proc sgplot data=have;
   vector x=aval y=yval / xorigin=base yorigin=yval 
          arrowdirection=out  lineattrs=(thickness=10)
   ;
   format yval yval.;
   refline 2.5 / axis=y  label='Some text label';
   yaxis label='Subject' values=(1 to 4);
   label aval='Some description';
run;&lt;/PRE&gt;</description>
      <pubDate>Mon, 16 Sep 2024 23:04:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Swimmer-Plot-Some-Arrows-Negative/m-p/944165#M25048</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2024-09-16T23:04:49Z</dc:date>
    </item>
    <item>
      <title>Re: Swimmer Plot Some Arrows Negative</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Swimmer-Plot-Some-Arrows-Negative/m-p/944166#M25049</link>
      <description>&lt;P&gt;TRTAN indicates which treatment the subject received in the dummy dataset.&lt;/P&gt;
&lt;P&gt;Data were requested...data provided.&lt;/P&gt;</description>
      <pubDate>Mon, 16 Sep 2024 22:44:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Swimmer-Plot-Some-Arrows-Negative/m-p/944166#M25049</guid>
      <dc:creator>_Hopper</dc:creator>
      <dc:date>2024-09-16T22:44:47Z</dc:date>
    </item>
    <item>
      <title>Re: Swimmer Plot Some Arrows Negative</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Swimmer-Plot-Some-Arrows-Negative/m-p/944180#M25050</link>
      <description>&lt;P&gt;&lt;A href="https://blogs.sas.com/content/graphicallyspeaking/2014/06/22/swimmer-plot/" target="_blank"&gt;https://blogs.sas.com/content/graphicallyspeaking/2014/06/22/swimmer-plot/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://blogs.sas.com/content/graphicallyspeaking/2018/05/13/a-combined-waterfall-and-swimmer-plot/" target="_blank"&gt;https://blogs.sas.com/content/graphicallyspeaking/2018/05/13/a-combined-waterfall-and-swimmer-plot/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://blogs.sas.com/content/graphicallyspeaking/2018/11/16/waterfall-graph-with-more-data-for-subject-part-2/" target="_blank"&gt;https://blogs.sas.com/content/graphicallyspeaking/2018/11/16/waterfall-graph-with-more-data-for-subject-part-2/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;And better post a picture to illustate what you are looking for.&lt;/P&gt;
&lt;P&gt;Don't let me to guess what you want.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And you can switch these two values manually from low to high to show the right output.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input Subjid $ TRTAN BASE AVAL;
cards;
A1            1            12         14
A2            1            8        10
B1           2            11          11
B2           2           10          13
;

proc sgplot data=have;
highlow y=Subjid low=base high=aval/type=bar group=trtan;
refline 'A2'/discreteoffset=0.5;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ksharp_0-1726536335456.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/100401i1F9366D85F3B9AA4/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ksharp_0-1726536335456.png" alt="Ksharp_0-1726536335456.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Sep 2024 01:25:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Swimmer-Plot-Some-Arrows-Negative/m-p/944180#M25050</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2024-09-17T01:25:40Z</dc:date>
    </item>
    <item>
      <title>Re: Swimmer Plot Some Arrows Negative</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Swimmer-Plot-Some-Arrows-Negative/m-p/949450#M25095</link>
      <description>&lt;P&gt;I guess this figure is what you want. If it isn't, please provide more information.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="screenshot.png" style="width: 629px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/101877i62FECCA010D7830A/image-size/large?v=v2&amp;amp;px=999" role="button" title="screenshot.png" alt="screenshot.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The code is as follows:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;data have;
input subjid $ trtan base aval;
cards;
A1 1 12 14
A2 1 8 10
A3 1 12 9
B1 2 11 11
B2 2 10 13
B3 2 14 10
;
run;

data have_new;
  length subjid $200 trtan base_new aval_new 8 base aval 8;
  length highcap lowcap $200;
  set have;
  if base&amp;gt;aval then do;
    highcap='NONE';
    lowcap='FILLEDARROW';
    base_new=aval;
    aval_new=base;
  end;
  else do;
    highcap='FILLEDARROW';
    lowcap='NONE';
    base_new=base;
    aval_new=aval;
  end;
run;



proc template;
define statgraph highlowbar;
  begingraph;
    layout overlay /
      xaxisopts=(display=(line ticks tickvalues) griddisplay=on
        linearopts=(viewmin=0 viewmax=15))
      yaxisopts=(griddisplay=on display=(line ticks tickvalues));

      highlowplot y=SUBJID high=AVAL_NEW low=BASE_NEW /
        group=drug outlineattrs=(pattern=solid)
        type=bar barwidth=0.4 highcap=HIGHCAP lowcap=LOWCAP;
    endlayout;
  endgraph;
end;

ods graphics on / reset outputfmt=png imagename='highlowbar';

proc sgrender data=have_new template=highlowbar;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 30 Oct 2024 06:26:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Swimmer-Plot-Some-Arrows-Negative/m-p/949450#M25095</guid>
      <dc:creator>Eric_Lee</dc:creator>
      <dc:date>2024-10-30T06:26:21Z</dc:date>
    </item>
  </channel>
</rss>

