<?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 in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-increment-datetime-variables/m-p/576238#M163082</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/148419"&gt;@asuman&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;data b;&lt;BR /&gt;y=datetime();&lt;BR /&gt;format y datetime21.;&lt;BR /&gt;want=intnx('dtmonth',y,2)+'02:10:06't;&lt;BR /&gt;format want datetime21.;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;results:&lt;BR /&gt;y=24JUL2019:21:42:04&lt;BR /&gt;want=01SEP2019:02:10:06&lt;BR /&gt;it's not the correct answer.Need assistance&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;If you don't tell INTNX() where in the target period you want it will set it to the BEGINNING of the period.&lt;/P&gt;
&lt;P&gt;You want to use SAME, not BEGINNING or END.&lt;/P&gt;</description>
    <pubDate>Wed, 24 Jul 2019 16:22:20 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2019-07-24T16:22:20Z</dc:date>
    <item>
      <title>How to increment datetime variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-increment-datetime-variables/m-p/576179#M163057</link>
      <description>&lt;P&gt;In a data set we have a column of&amp;nbsp; date in datetime format.&lt;/P&gt;
&lt;P&gt;I want to increment the date with 2 months,4 hrs,10 min and 6 second.&lt;/P&gt;
&lt;P&gt;Kindly help to write this query.&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jul 2019 15:09:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-increment-datetime-variables/m-p/576179#M163057</guid>
      <dc:creator>asuman</dc:creator>
      <dc:date>2019-07-24T15:09:18Z</dc:date>
    </item>
    <item>
      <title>Re: date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-increment-datetime-variables/m-p/576180#M163058</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/148419"&gt;@asuman&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;In a data set we have a column of&amp;nbsp; date in datetime format.&lt;/P&gt;
&lt;P&gt;I want to increment the date with 2 months,4 hrs,10 min and 6 second.&lt;/P&gt;
&lt;P&gt;Kindly help to write this query.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;So you have column with DATETIME (not DATE).&lt;/P&gt;
&lt;P&gt;You can use the INTNX() function to increment dates by periods.&amp;nbsp; You will HAVE to use it to increment by MONTH, but since the value is DATETIME you need to use the DTMONTH interval.&amp;nbsp; To increment by time just add the time value since both DATETIME and TIME values are stored as number of seconds.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;want=intnx('dtmonth',have,2,'same')+'04:10:06't ;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 24 Jul 2019 14:47:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-increment-datetime-variables/m-p/576180#M163058</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-07-24T14:47:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to increment datetime variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-increment-datetime-variables/m-p/576196#M163065</link>
      <description>&lt;P&gt;I've updated your subject line to be more reflective of your question. Please take the time to add a descriptive subject line in the future.&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jul 2019 15:09:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-increment-datetime-variables/m-p/576196#M163065</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-07-24T15:09:52Z</dc:date>
    </item>
    <item>
      <title>Re: date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-increment-datetime-variables/m-p/576237#M163081</link>
      <description>data b;&lt;BR /&gt;y=datetime();&lt;BR /&gt;format y datetime21.;&lt;BR /&gt;want=intnx('dtmonth',y,2)+'02:10:06't;&lt;BR /&gt;format want datetime21.;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;results:&lt;BR /&gt;y=24JUL2019:21:42:04&lt;BR /&gt;want=01SEP2019:02:10:06&lt;BR /&gt;it's not the correct answer.Need assistance</description>
      <pubDate>Wed, 24 Jul 2019 16:20:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-increment-datetime-variables/m-p/576237#M163081</guid>
      <dc:creator>asuman</dc:creator>
      <dc:date>2019-07-24T16:20:43Z</dc:date>
    </item>
    <item>
      <title>Re: date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-increment-datetime-variables/m-p/576238#M163082</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/148419"&gt;@asuman&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;data b;&lt;BR /&gt;y=datetime();&lt;BR /&gt;format y datetime21.;&lt;BR /&gt;want=intnx('dtmonth',y,2)+'02:10:06't;&lt;BR /&gt;format want datetime21.;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;results:&lt;BR /&gt;y=24JUL2019:21:42:04&lt;BR /&gt;want=01SEP2019:02:10:06&lt;BR /&gt;it's not the correct answer.Need assistance&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;If you don't tell INTNX() where in the target period you want it will set it to the BEGINNING of the period.&lt;/P&gt;
&lt;P&gt;You want to use SAME, not BEGINNING or END.&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jul 2019 16:22:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-increment-datetime-variables/m-p/576238#M163082</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-07-24T16:22:20Z</dc:date>
    </item>
    <item>
      <title>Re: date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-increment-datetime-variables/m-p/576241#M163083</link>
      <description>Thanks TOM.It's Working</description>
      <pubDate>Wed, 24 Jul 2019 16:25:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-increment-datetime-variables/m-p/576241#M163083</guid>
      <dc:creator>asuman</dc:creator>
      <dc:date>2019-07-24T16:25:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to increment datetime variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-increment-datetime-variables/m-p/576242#M163084</link>
      <description>Thank you for making subject line more effective,i will take care this in future.</description>
      <pubDate>Wed, 24 Jul 2019 16:26:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-increment-datetime-variables/m-p/576242#M163084</guid>
      <dc:creator>asuman</dc:creator>
      <dc:date>2019-07-24T16:26:59Z</dc:date>
    </item>
  </channel>
</rss>

