<?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: Creating year value from date and month in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Creating-year-value-from-date-and-month/m-p/494792#M130456</link>
    <description>&lt;P&gt;Something like:&lt;/P&gt;
&lt;PRE&gt;data want;
  set have;
  if input(cats(renewal_date,"2018"),date9.) &amp;gt; today()) then new_renewel_date=input(cats(renewel_date,"2019"),date9.);
  else renewel_date=input(cats(renewal_date,"2018"),date9.);
run;&lt;/PRE&gt;
&lt;P&gt;Not sure its a good idea though, if you run the same code tomorrow, you will likely get different results.&amp;nbsp; Far better to have a baseline and compare against a fixed baseline rather than a moving "today" timepoint.&lt;/P&gt;</description>
    <pubDate>Wed, 12 Sep 2018 12:22:16 GMT</pubDate>
    <dc:creator>RW9</dc:creator>
    <dc:date>2018-09-12T12:22:16Z</dc:date>
    <item>
      <title>Creating year value from date and month</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-year-value-from-date-and-month/m-p/494782#M130450</link>
      <description>&lt;P&gt;I've a variable called &lt;SPAN&gt;Renewal_date&amp;nbsp;&lt;/SPAN&gt;and I've to create new variable(&lt;SPAN&gt;New_Renewal_date&lt;/SPAN&gt;) with the year. If DDMM is past then I've to add 2019 and if it is current and future value then I've to add 2018.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;U&gt;Example&lt;/U&gt;:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Renewal_date &amp;nbsp;New_Renewal_date&lt;BR /&gt;15jun &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;15jun2019&lt;BR /&gt;11sep &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 11sep2019&lt;BR /&gt;14sep &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 14sep2018&lt;BR /&gt;02jan &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;02jan2019&lt;/P&gt;</description>
      <pubDate>Wed, 12 Sep 2018 12:10:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-year-value-from-date-and-month/m-p/494782#M130450</guid>
      <dc:creator>Babloo</dc:creator>
      <dc:date>2018-09-12T12:10:21Z</dc:date>
    </item>
    <item>
      <title>Re: Creating year value from date and month</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-year-value-from-date-and-month/m-p/494791#M130455</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/8409"&gt;@Babloo&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I've a variable called &lt;SPAN&gt;Renewal_date&amp;nbsp;&lt;/SPAN&gt;and I've to create new variable(&lt;SPAN&gt;New_Renewal_date&lt;/SPAN&gt;) with the year. If DDMM is past then I've to add 2019 and if it is current and future value then I've to add 2018.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;U&gt;Example&lt;/U&gt;:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Renewal_date &amp;nbsp;New_Renewal_date&lt;BR /&gt;15jun &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;15jun2019&lt;BR /&gt;11sep &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 11sep2019&lt;BR /&gt;14sep &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 14sep2018&lt;BR /&gt;02jan &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;02jan2019&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;First you have to obtain an actual month and day of month from the column named Renewal_date. Once you have that, the&amp;nbsp;MDY function can&amp;nbsp;append years to dates. Test if renewal date 2018 is in the past or in the future, then use MDY to get new_renewal_date.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Sep 2018 12:22:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-year-value-from-date-and-month/m-p/494791#M130455</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2018-09-12T12:22:28Z</dc:date>
    </item>
    <item>
      <title>Re: Creating year value from date and month</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-year-value-from-date-and-month/m-p/494792#M130456</link>
      <description>&lt;P&gt;Something like:&lt;/P&gt;
&lt;PRE&gt;data want;
  set have;
  if input(cats(renewal_date,"2018"),date9.) &amp;gt; today()) then new_renewel_date=input(cats(renewel_date,"2019"),date9.);
  else renewel_date=input(cats(renewal_date,"2018"),date9.);
run;&lt;/PRE&gt;
&lt;P&gt;Not sure its a good idea though, if you run the same code tomorrow, you will likely get different results.&amp;nbsp; Far better to have a baseline and compare against a fixed baseline rather than a moving "today" timepoint.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Sep 2018 12:22:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-year-value-from-date-and-month/m-p/494792#M130456</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-09-12T12:22:16Z</dc:date>
    </item>
  </channel>
</rss>

