<?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: Adding month to datetime20.0 value in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Adding-month-to-datetime20-0-value/m-p/134842#M36529</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you very much Tom.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This works perfectly.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 07 Nov 2013 20:30:45 GMT</pubDate>
    <dc:creator>cynthya</dc:creator>
    <dc:date>2013-11-07T20:30:45Z</dc:date>
    <item>
      <title>Adding month to datetime20.0 value</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Adding-month-to-datetime20-0-value/m-p/134839#M36526</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a table with date values. The dates in datetime20.0 format.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would like to add 22 months to those value using an sql procedure.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What is the easiest way to do this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for your help and time.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Nov 2013 20:12:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Adding-month-to-datetime20-0-value/m-p/134839#M36526</guid>
      <dc:creator>cynthya</dc:creator>
      <dc:date>2013-11-07T20:12:51Z</dc:date>
    </item>
    <item>
      <title>Re: Adding month to datetime20.0 value</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Adding-month-to-datetime20-0-value/m-p/134840#M36527</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/lefunctionsref/63354/HTML/default/viewer.htm#p10v3sa3i4kfxfn1sovhi5xzxh8n.htm" title="http://support.sas.com/documentation/cdl/en/lefunctionsref/63354/HTML/default/viewer.htm#p10v3sa3i4kfxfn1sovhi5xzxh8n.htm"&gt;SAS(R) 9.3 Functions and CALL Routines: Reference&lt;/A&gt; (intnx and the related fucntions) &lt;BR /&gt;Be aware as this is a SAS function Performance will be the best wiht that for SAS-datasets.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When you are dealing with an external DBMS this can become challenging as date/time values are not standardized.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Nov 2013 20:21:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Adding-month-to-datetime20-0-value/m-p/134840#M36527</guid>
      <dc:creator>jakarman</dc:creator>
      <dc:date>2013-11-07T20:21:51Z</dc:date>
    </item>
    <item>
      <title>Re: Adding month to datetime20.0 value</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Adding-month-to-datetime20-0-value/m-p/134841#M36528</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Use the INTNX() function.&lt;/P&gt;&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000212700.htm" title="http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000212700.htm"&gt;SAS(R) 9.2 Language Reference: Dictionary, Fourth Edition&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;If you are using DATETIME20.0 format then you have DATETIME values instead of DATE values.&amp;nbsp; So use the DTMONTH interval instead of the MONTH interval. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;data _null_;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; now=datetime();&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; future = intnx('dtmonth',now,22-1,'S');&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; format now future datetime22.;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; put (_all_) (=/);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;now=07NOV2013:15:23:08&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;future=07AUG2015:15:23:08&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;You can use the function call in SQL the same as you would in a DATA step, but you might need to give the result a variable name.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;select mydate&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; , intnx('dtmonth',MYDATE,22-1,'S') as future_date format=datetime22.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;from mytable&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Nov 2013 20:24:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Adding-month-to-datetime20-0-value/m-p/134841#M36528</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2013-11-07T20:24:17Z</dc:date>
    </item>
    <item>
      <title>Re: Adding month to datetime20.0 value</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Adding-month-to-datetime20-0-value/m-p/134842#M36529</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you very much Tom.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This works perfectly.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Nov 2013 20:30:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Adding-month-to-datetime20-0-value/m-p/134842#M36529</guid>
      <dc:creator>cynthya</dc:creator>
      <dc:date>2013-11-07T20:30:45Z</dc:date>
    </item>
  </channel>
</rss>

