<?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: PROC SGPLOT datastep in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/PROC-SGPLOT-datastep/m-p/688437#M209128</link>
    <description>&lt;P&gt;Dear Ballardw,&lt;BR /&gt;I have now updated the question&lt;/P&gt;</description>
    <pubDate>Fri, 02 Oct 2020 07:20:55 GMT</pubDate>
    <dc:creator>lone0708</dc:creator>
    <dc:date>2020-10-02T07:20:55Z</dc:date>
    <item>
      <title>PROC SGPLOT datastep</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SGPLOT-datastep/m-p/688331#M209071</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;I am working on a plot like this:&amp;nbsp;&lt;A title="https://blogs.sas.com/content/graphicallyspeaking/2018/03/02/series-plot-varying-attributes/" href="https://blogs.sas.com/content/graphicallyspeaking/2018/03/02/series-plot-varying-attributes/" target="_blank" rel="noopener"&gt;https://blogs.sas.com/content/graphicallyspeaking/2018/03/02/series-plot-varying-attributes/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I am currently struggling with the datastep where I need to define that&amp;nbsp;&lt;SPAN&gt;the&amp;nbsp;last point of the previous curve segment is replicated as the first point of the next segment.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I have two dates defining the change in color. When age (age_measure) passes age 1, then&amp;nbsp;I want a change in the color and again when age passes age 2 a new change in color.&amp;nbsp;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;So&amp;nbsp;I&amp;nbsp;need to get the determinant of the colorresponse variable appear twice: Meaning age 1 appears both as colorresponse variabel 1 and 2, and age 2 appearing both as colorresponse variable 2 and 3 to get the datapoints to connect in the plot.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Do you have any ideas on how to define that in a datastep?&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Example data below:&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;patientid = patient id, a1 = age 1, a2 = age 2, visit date = examination date, measure = measurement at examination date, age_measure = age at measurement.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The curve is measure as a function of age_measure, where t&lt;SPAN&gt;he curve needs to change color when age 1 and age 2 are passed (interpolated values of age_measure.). Age 1 always comes before age 2, but some patients jump directly to age 2. Some patients might not have either age 1 or 2.&amp;nbsp;&lt;BR /&gt;I don't know if this this possible in proc&amp;nbsp;sgplot as the curve needs to "break" several times, like in a spaghetti-plot. But maybe proc gplot works,&amp;nbsp;I have just never used that before.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;data patients;
input patientid $ a1 a2;
datalines;
1 32 34
2 23 .
3 22 35
4 30 31
5 . 28
;

data visits;
input patientid $ visit_date :yymmdd8. measure age_measure;
format visit_date yymmdd10.;
datalines;
1  20180101  3.4   20
1  20180505  2.3   35
2  20170210  7.3   15
2  20170217  7.2   24
2  20170220  7.1   35
3  20170221  5.4   33
4  20180202  3.4   30
4  20180204  3.2   37
5  20180504  5.6   28
5  20180505  5.0   32
;
data have;
merge
  patients
  visits
;
by patientid;
run;&lt;/LI-CODE&gt;&lt;P&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Oct 2020 07:19:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SGPLOT-datastep/m-p/688331#M209071</guid>
      <dc:creator>lone0708</dc:creator>
      <dc:date>2020-10-02T07:19:58Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SGPLOT datastep</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SGPLOT-datastep/m-p/688343#M209080</link>
      <description>&lt;P&gt;Data example is important.&lt;/P&gt;
&lt;P&gt;Instructions here: &lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712&lt;/A&gt; will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the &amp;lt;/&amp;gt; icon or attached as text to show exactly what you have and that we can test code against.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And then tell use where the curve change needs to happen.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Oct 2020 20:19:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SGPLOT-datastep/m-p/688343#M209080</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-10-01T20:19:23Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SGPLOT datastep</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SGPLOT-datastep/m-p/688437#M209128</link>
      <description>&lt;P&gt;Dear Ballardw,&lt;BR /&gt;I have now updated the question&lt;/P&gt;</description>
      <pubDate>Fri, 02 Oct 2020 07:20:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SGPLOT-datastep/m-p/688437#M209128</guid>
      <dc:creator>lone0708</dc:creator>
      <dc:date>2020-10-02T07:20:55Z</dc:date>
    </item>
  </channel>
</rss>

