<?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: derive start date and end date in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/derive-start-date-and-end-date/m-p/812711#M320668</link>
    <description>OK. Thank you for your reminder. &lt;BR /&gt;&lt;BR /&gt;VERY MUCH appreicated. That is what I want . &lt;BR /&gt;&lt;BR /&gt;Thank you very much. &lt;BR /&gt;&lt;BR /&gt;Jack.</description>
    <pubDate>Wed, 11 May 2022 16:56:25 GMT</pubDate>
    <dc:creator>Jack2012</dc:creator>
    <dc:date>2022-05-11T16:56:25Z</dc:date>
    <item>
      <title>derive start date and end date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/derive-start-date-and-end-date/m-p/812700#M320661</link>
      <description>&lt;P&gt;HI All,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think this is q simple question, but uncertain how to work it out.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So far as I recall, maybe use RETAIN, but have no clue on.&amp;nbsp; Hope someone can favor me.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jack&lt;/P&gt;
&lt;P&gt;/*-------------------------------------------------------*/&lt;/P&gt;
&lt;P&gt;Below picture is the dummy data, I would like to record the same dose lifecycle trajactory.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;what I want to have is:&lt;/P&gt;
&lt;P&gt;exdose&amp;nbsp; subjid&amp;nbsp; dose_st_dt&amp;nbsp; &amp;nbsp;dose_en_dt&lt;/P&gt;
&lt;P&gt;110mg&amp;nbsp; 615010 2021-12-10&amp;nbsp; 2022-01-19&lt;/P&gt;
&lt;P&gt;0mg&amp;nbsp; &amp;nbsp; &amp;nbsp; 615010 2022-01-20&amp;nbsp; 2022-01-23&amp;nbsp;&lt;/P&gt;
&lt;P&gt;110mg&amp;nbsp; &amp;nbsp;615010 2022-01-24&amp;nbsp; 2022-02-15&lt;/P&gt;
&lt;P&gt;0mg&amp;nbsp; &amp;nbsp; &amp;nbsp; 615010 2022-02-16&amp;nbsp; &amp;nbsp;2022-02-22&lt;/P&gt;
&lt;P&gt;55mg&amp;nbsp; &amp;nbsp; 615010 2022-02-23&amp;nbsp; &amp;nbsp;2022-03-29&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&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="Jack2012_0-1652286050790.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/71326iF56CB0CF8BDDE4F2/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Jack2012_0-1652286050790.png" alt="Jack2012_0-1652286050790.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 11 May 2022 16:27:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/derive-start-date-and-end-date/m-p/812700#M320661</guid>
      <dc:creator>Jack2012</dc:creator>
      <dc:date>2022-05-11T16:27:54Z</dc:date>
    </item>
    <item>
      <title>Re: derive start date and end date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/derive-start-date-and-end-date/m-p/812702#M320662</link>
      <description>&lt;P&gt;From now on, please do not provide data as screen captures, we can't write programs to use screen capture data. Instead, we need data provided as SAS data step code which you can type in yourself, or via &lt;A href="https://blogs.sas.com/content/sastraining/2016/03/11/jedi-sas-tricks-data-to-data-step-macro/" target="_self"&gt;these instructions&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, it would help if you provided a clear description of how the final table is calculated from the input data. Don't make us guess, sometimes we get it wrong.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So, without actual data, my code is UNTESTED. It is also based on my guesses as to what the method is, and maybe I guessed wrong.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data intermediate;
    set have;
    prev_exdose=lag(exdose);
    prev_subj=lag(subjid);
    if (exdose^=prev_exdose and subjid=prev_subj) or subjid^=prev_subj then group+1;
run;
proc summary data=intermediate nway;
    class group;
    id exdose subjid;
    var dose_st_dt dose_en_dt;
    output out=want min(dose_st_date)= max(dose_en_dt)=;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 11 May 2022 16:49:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/derive-start-date-and-end-date/m-p/812702#M320662</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-05-11T16:49:45Z</dc:date>
    </item>
    <item>
      <title>Re: derive start date and end date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/derive-start-date-and-end-date/m-p/812711#M320668</link>
      <description>OK. Thank you for your reminder. &lt;BR /&gt;&lt;BR /&gt;VERY MUCH appreicated. That is what I want . &lt;BR /&gt;&lt;BR /&gt;Thank you very much. &lt;BR /&gt;&lt;BR /&gt;Jack.</description>
      <pubDate>Wed, 11 May 2022 16:56:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/derive-start-date-and-end-date/m-p/812711#M320668</guid>
      <dc:creator>Jack2012</dc:creator>
      <dc:date>2022-05-11T16:56:25Z</dc:date>
    </item>
  </channel>
</rss>

