<?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: draw figure with different groups and different timepoints in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/draw-figure-with-different-groups-and-different-timepoints/m-p/364771#M12681</link>
    <description>&lt;P&gt;Here's a basic two vector example similar to what you want:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data example;
   input gr $ xstart ystart xend yend;
datalines;
a  23 18 33 24
b  10 29 16 44
;
run;

proc sgplot data=example;
  vector x=xend y=yend/ xorigin=xstart yorigin=ystart group=gr ;
run;&lt;/PRE&gt;
&lt;P&gt;Lots of options for appearance, you may want arrowdirection=both and arrowheadshape=filled (or maybe barbed) .&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The key will be getting both x,y paired variables in one record. Not sure about the time point bit though. Perhaps you may need to have separte x,y variables for the different groups and use overlayed (multiple vector statements) to get different appearances.&lt;/P&gt;</description>
    <pubDate>Tue, 06 Jun 2017 21:56:54 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2017-06-06T21:56:54Z</dc:date>
    <item>
      <title>draw figure with different groups and different timepoints</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/draw-figure-with-different-groups-and-different-timepoints/m-p/364765#M12679</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a dataset with two groups (treatment and control), and each patient has two timepoints (timepoint1 and timepoint2), I want draw a figure using Age and result like below with SAS 9.4. Anyone can give me some clue or example similar with&amp;nbsp;this?&lt;/P&gt;&lt;P&gt;The x-axis is Age and y-asix is Result, both are continuous variable.&lt;/P&gt;&lt;P&gt;I want different color with different groups, different signs with different timepoints.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/9246i33BB9443BF5DB0AD/image-size/original?v=1.0&amp;amp;px=-1" border="0" alt="figure.png" title="figure.png" /&gt;&lt;/P&gt;&lt;P&gt;Thanks so much,&lt;/P&gt;&lt;P&gt;C&lt;/P&gt;</description>
      <pubDate>Tue, 06 Jun 2017 21:30:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/draw-figure-with-different-groups-and-different-timepoints/m-p/364765#M12679</guid>
      <dc:creator>echoli</dc:creator>
      <dc:date>2017-06-06T21:30:10Z</dc:date>
    </item>
    <item>
      <title>Re: draw figure with different groups and different timepoints</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/draw-figure-with-different-groups-and-different-timepoints/m-p/364771#M12681</link>
      <description>&lt;P&gt;Here's a basic two vector example similar to what you want:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data example;
   input gr $ xstart ystart xend yend;
datalines;
a  23 18 33 24
b  10 29 16 44
;
run;

proc sgplot data=example;
  vector x=xend y=yend/ xorigin=xstart yorigin=ystart group=gr ;
run;&lt;/PRE&gt;
&lt;P&gt;Lots of options for appearance, you may want arrowdirection=both and arrowheadshape=filled (or maybe barbed) .&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The key will be getting both x,y paired variables in one record. Not sure about the time point bit though. Perhaps you may need to have separte x,y variables for the different groups and use overlayed (multiple vector statements) to get different appearances.&lt;/P&gt;</description>
      <pubDate>Tue, 06 Jun 2017 21:56:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/draw-figure-with-different-groups-and-different-timepoints/m-p/364771#M12681</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-06-06T21:56:54Z</dc:date>
    </item>
    <item>
      <title>figures show relationship but with different groups and timepoints</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/draw-figure-with-different-groups-and-different-timepoints/m-p/365032#M12696</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a dataset, and want to test the relationship between age and result. but my goal is draw a figure like the attachment file. I tried to proc gplot and Spaghetti Plots (&lt;A href="http://blogs.sas.com/content/graphicallyspeaking/2014/08/12/creating-spaghetti-plots-just-got-easy/" target="_blank"&gt;http://blogs.sas.com/content/graphicallyspeaking/2014/08/12/creating-spaghetti-plots-just-got-easy/&lt;/A&gt;) but found I am wrong. Any one have experience with figures like my goal?...... Even no idea how to start....&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE border="0" cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Group&lt;/TD&gt;&lt;TD&gt;ID&lt;/TD&gt;&lt;TD&gt;Age&lt;/TD&gt;&lt;TD&gt;TimePoint&lt;/TD&gt;&lt;TD&gt;Result&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;TX&lt;/TD&gt;&lt;TD&gt;14468&lt;/TD&gt;&lt;TD&gt;15.8&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;75.74532&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;TX&lt;/TD&gt;&lt;TD&gt;14468&lt;/TD&gt;&lt;TD&gt;17&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;57.56404&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;TX&lt;/TD&gt;&lt;TD&gt;15597&lt;/TD&gt;&lt;TD&gt;15.1&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;62.84454&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;TX&lt;/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gt;&lt;TD&gt;cont&lt;/TD&gt;&lt;TD&gt;26438&lt;/TD&gt;&lt;TD&gt;9.7&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;33.98369&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV class="main-wrap"&gt;&lt;DIV class="main wrap cf"&gt;&lt;DIV class="row"&gt;&lt;DIV class="col-8 main-content"&gt;&lt;DIV class="heading cf"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="heading cf"&gt;Thanks,&lt;/DIV&gt;&lt;DIV class="heading cf"&gt;C&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;</description>
      <pubDate>Wed, 07 Jun 2017 15:14:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/draw-figure-with-different-groups-and-different-timepoints/m-p/365032#M12696</guid>
      <dc:creator>echoli</dc:creator>
      <dc:date>2017-06-07T15:14:14Z</dc:date>
    </item>
    <item>
      <title>Re: figures show relationship but with different groups and timepoints</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/draw-figure-with-different-groups-and-different-timepoints/m-p/365035#M12697</link>
      <description>&lt;P&gt;Yes, you can use the VECTOR statement. An example is shown in &lt;A href="http://blogs.sas.com/content/iml/2016/09/14/nearest-neighbors-sas.html" target="_self"&gt;a blog post about connecting a point to its nearest neighbor.&lt;/A&gt;.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Jun 2017 15:20:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/draw-figure-with-different-groups-and-different-timepoints/m-p/365035#M12697</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2017-06-07T15:20:04Z</dc:date>
    </item>
    <item>
      <title>Re: figures show relationship but with different groups and timepoints</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/draw-figure-with-different-groups-and-different-timepoints/m-p/365041#M12698</link>
      <description>&lt;P&gt;Further details: Use &lt;A href="https://stats.idre.ucla.edu/sas/modules/how-to-reshape-data-long-to-wide-using-proc-transpose/" target="_self"&gt;PROC TRANSPOSE&lt;/A&gt; or the DATA step to convert the data from long to wide format. Then you can use the VECTOR statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
length Group $4.;
input Group	ID	Age	TimePoint	Result;
datalines;
TX	   14468	15.8	1	75.74532
TX	   14468	17	2	57.56404
TX	   15597	15.1	1	62.84454
TX	   15597	16.1	2	61.26036
TX	   21016	9.2	1	40.1348
TX	   21016	10.3	2	40.7989
TX	   21834	11.1	1	34.01227
TX	   21834	12	2	35.61295
TX	   21838	13.6	1	46.02287
TX	   21838	14.7	2	43.08785
TX	   22596	16.1	1	50.71742
cont	24089	11.1	1	72.16842
cont	24089	12.1	2	45.67053
cont	24336	12.8	1	46.03624
cont	24336	13.8	2	50.30168
cont	25996	16.6	1	80.43335
cont	25996	17.6	2	77.73658
cont	26438	8.7	1	56.22557
cont	26438	9.7	2	33.98369
;

data want;
retain t1 t2 age1 age2 result1;
set have;
if TimePoint=1 then do;
   t1 = Result; 
   age1 = age;
end;
else do; 
   t2 = Result;
   age2 = age;
   output;
end;
run;

proc sgplot data=want;
vector x=age2 y=t2 / xorigin=age1 yorigin=t1 group=Group;
xaxis label=age;
yaxis label=Result;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 07 Jun 2017 15:32:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/draw-figure-with-different-groups-and-different-timepoints/m-p/365041#M12698</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2017-06-07T15:32:19Z</dc:date>
    </item>
    <item>
      <title>Re: figures show relationship but with different groups and timepoints</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/draw-figure-with-different-groups-and-different-timepoints/m-p/365176#M12707</link>
      <description>&lt;P&gt;Thanks so much, Rick. That works!!!!&lt;/P&gt;</description>
      <pubDate>Wed, 07 Jun 2017 20:43:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/draw-figure-with-different-groups-and-different-timepoints/m-p/365176#M12707</guid>
      <dc:creator>echoli</dc:creator>
      <dc:date>2017-06-07T20:43:12Z</dc:date>
    </item>
  </channel>
</rss>

