<?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: Date Ranges and history in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Date-Ranges-and-history/m-p/440869#M110223</link>
    <description>&lt;P&gt;Please provide some examples for your datasets. Use the macro provided in&amp;nbsp;&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; to convert your datasets to data steps, and post the resulting code as advised in &lt;A href="https://communities.sas.com/t5/help/faqpage/faq-category-id/posting?nobounce" target="_blank"&gt;https://communities.sas.com/t5/help/faqpage/faq-category-id/posting?nobounce&lt;/A&gt;.&lt;/P&gt;</description>
    <pubDate>Wed, 28 Feb 2018 13:08:25 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2018-02-28T13:08:25Z</dc:date>
    <item>
      <title>Date Ranges and history</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-Ranges-and-history/m-p/440861#M110222</link>
      <description>&lt;P&gt;I can either do this in Base SAS or SAS DI Studio or a combination of both.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a table with contract information.&amp;nbsp; So contract ID, contract period , begin date and end date.&amp;nbsp; Normally each contact ID/contract period has a date span of one year.&amp;nbsp; So January 1st through December 31st.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;That table can be joined to a header table on contract id and contact period.&amp;nbsp; In the header table there is an action date, then within each action date there can be multiple rows with begin and end dates.&amp;nbsp; For example:&lt;/P&gt;&lt;P&gt;Action Date&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Begin&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;End&lt;/P&gt;&lt;P&gt;Mar 2015&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Jan 1 , 2015&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;may 31, 2015&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;June 1, 2015&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;November 30, 2015&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Feb 2015&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;SPAN&gt;J&lt;/SPAN&gt;&lt;SPAN&gt;an&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;1 , 2015&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;may 31, 2015&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;June 1, 2015&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;November 30, 2015&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Dec 1, 2015&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Dec 31, 2015&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I need to start with the most recent action date which is March 2015 and looks at the begin/end dates associated with that action date to complete the date range for the contract period.&amp;nbsp; In this case for March 2015 action date the 2 rows only cover 11 months out of 12 for that contract id and period.&amp;nbsp; In this case I need to look at the action date before to see if I can find that missing month.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I would like to see the following for Action date of March 2015.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Action Date&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Begin&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;End&lt;/P&gt;&lt;P&gt;Mar&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;2015&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Jan&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;1 , 2015&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;may 31, 2015&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; June 1, 2015&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;November 30, 2015&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;SPAN&gt;&amp;nbsp; Dec 1, 2015&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Dec 31, 2015&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Since I need to keep the history for all action dates I then need to forget about March 2015 action date and focus on Feb 2015 action date.&amp;nbsp; Since the 3 rows associate with that action date cover the whole contract I am done with that date.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;If there was another action date I need to do the same process as I did for the first action date by trying to complete the contract period and if those dates arent present I have to look back to the previous action&amp;nbsp;date and even one before that if not available.&amp;nbsp; This process continues until all actions dates show a true history.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I am not asking for the code to be written - I am really looking for some ideas on where to even begin.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Feb 2018 12:41:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-Ranges-and-history/m-p/440861#M110222</guid>
      <dc:creator>Kam</dc:creator>
      <dc:date>2018-02-28T12:41:06Z</dc:date>
    </item>
    <item>
      <title>Re: Date Ranges and history</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-Ranges-and-history/m-p/440869#M110223</link>
      <description>&lt;P&gt;Please provide some examples for your datasets. Use the macro provided in&amp;nbsp;&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; to convert your datasets to data steps, and post the resulting code as advised in &lt;A href="https://communities.sas.com/t5/help/faqpage/faq-category-id/posting?nobounce" target="_blank"&gt;https://communities.sas.com/t5/help/faqpage/faq-category-id/posting?nobounce&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Feb 2018 13:08:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-Ranges-and-history/m-p/440869#M110223</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-02-28T13:08:25Z</dc:date>
    </item>
  </channel>
</rss>

