<?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: Help calculating a number field that represents months from a datetime field in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Help-calculating-a-number-field-that-represents-months-from-a/m-p/893845#M39770</link>
    <description>&lt;P&gt;Thank You!!!&amp;nbsp; &amp;nbsp;This worked perfectly!!&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 12 Sep 2023 16:37:08 GMT</pubDate>
    <dc:creator>ScotchCat</dc:creator>
    <dc:date>2023-09-12T16:37:08Z</dc:date>
    <item>
      <title>Help calculating a number field that represents months from a datetime field</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Help-calculating-a-number-field-that-represents-months-from-a/m-p/893641#M39751</link>
      <description>&lt;P&gt;Hi - I have a data table that contains a field that represents number of months and a datetime field.&amp;nbsp; &amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm attempting to subtract the 'Months' field from the 'LastDate' field to create the 'NewDateNeeded'.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any assistance appreciated!!&amp;nbsp; &amp;nbsp;&lt;/P&gt;
&lt;TABLE width="344"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="64"&gt;Months&lt;/TD&gt;
&lt;TD width="140"&gt;LastDate&lt;/TD&gt;
&lt;TD width="140"&gt;NewDateNeeded&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;2&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp; 01SEP2021:00:00:00&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp; 01JUL2023:00:00:00&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp; 01MAR2022:00:00:00&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp; 01FEB2022:00:00:00&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;4&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp; 01MAY2019:00:00:00&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp; 01JAN2019:00:00:00&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;3&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp; 01DEC2022:00:00:00&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp; 01SEP2022:00:00:00&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;4&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp; 01JUL2023:00:00:00&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp; 01MAR2023:00:00:00&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;2&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp; 01JAN2019:00:00:00&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp; 01NOV2018:00:00:00&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;</description>
      <pubDate>Mon, 11 Sep 2023 20:37:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Help-calculating-a-number-field-that-represents-months-from-a/m-p/893641#M39751</guid>
      <dc:creator>ScotchCat</dc:creator>
      <dc:date>2023-09-11T20:37:06Z</dc:date>
    </item>
    <item>
      <title>Re: Help calculating a number field that represents months from a datetime field</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Help-calculating-a-number-field-that-represents-months-from-a/m-p/893645#M39752</link>
      <description>&lt;P&gt;Since your "dates" are actually what SAS considers to be date/time values, you need to use a date/time interval in INTCK.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In a SAS data step, use&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;newdateneeded = intck('dtmonth',lastdate,-2,'s');
format newdateneeded datetime18.;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Sep 2023 21:10:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Help-calculating-a-number-field-that-represents-months-from-a/m-p/893645#M39752</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-09-11T21:10:53Z</dc:date>
    </item>
    <item>
      <title>Re: Help calculating a number field that represents months from a datetime field</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Help-calculating-a-number-field-that-represents-months-from-a/m-p/893652#M39755</link>
      <description>&lt;P&gt;I think we have a typo and want INTNX instead of INTCK here.&lt;/P&gt;</description>
      <pubDate>Mon, 11 Sep 2023 21:31:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Help-calculating-a-number-field-that-represents-months-from-a/m-p/893652#M39755</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2023-09-11T21:31:43Z</dc:date>
    </item>
    <item>
      <title>Re: Help calculating a number field that represents months from a datetime field</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Help-calculating-a-number-field-that-represents-months-from-a/m-p/893800#M39763</link>
      <description>&lt;P&gt;P.S. I forgot to mention that my table has well over 5K rows, typing in the month to subtract individually is not an option.&amp;nbsp; I've tried the field name instead without success.&amp;nbsp; Please Help!!&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Sep 2023 14:27:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Help-calculating-a-number-field-that-represents-months-from-a/m-p/893800#M39763</guid>
      <dc:creator>ScotchCat</dc:creator>
      <dc:date>2023-09-12T14:27:22Z</dc:date>
    </item>
    <item>
      <title>Re: Help calculating a number field that represents months from a datetime field</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Help-calculating-a-number-field-that-represents-months-from-a/m-p/893822#M39765</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/210216"&gt;@ScotchCat&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;P.S. I forgot to mention that my table has well over 5K rows, typing in the month to subtract individually is not an option.&amp;nbsp; I've tried the field name instead without success.&amp;nbsp; Please Help!!&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;The way your initial post reads very strongly implies that&amp;nbsp; your existing data set has a months variable to apply to the given Lastdate value. If that is not the case then where have you provided information on why month is wanted? No where.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What "field name"???? You haven't shown anything like a "field name" that would hold anything related to a number of months.&lt;/P&gt;
&lt;P&gt;So show us an example of your actual data set. Don't add or remove anything. Then using that example of the data walk us through description of how we are supposed to know that Lastdate needs to be shifted by 2 months, 1 month or 16 months. Whatever is needed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Sep 2023 15:13:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Help-calculating-a-number-field-that-represents-months-from-a/m-p/893822#M39765</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2023-09-12T15:13:21Z</dc:date>
    </item>
    <item>
      <title>Re: Help calculating a number field that represents months from a datetime field</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Help-calculating-a-number-field-that-represents-months-from-a/m-p/893841#M39769</link>
      <description>&lt;P&gt;Try this modification of my earlier code&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;newdateneeded = intnx('dtmonth',lastdate,-months,'s');
format newdateneeded datetime18.;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 12 Sep 2023 16:27:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Help-calculating-a-number-field-that-represents-months-from-a/m-p/893841#M39769</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-09-12T16:27:01Z</dc:date>
    </item>
    <item>
      <title>Re: Help calculating a number field that represents months from a datetime field</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Help-calculating-a-number-field-that-represents-months-from-a/m-p/893845#M39770</link>
      <description>&lt;P&gt;Thank You!!!&amp;nbsp; &amp;nbsp;This worked perfectly!!&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Sep 2023 16:37:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Help-calculating-a-number-field-that-represents-months-from-a/m-p/893845#M39770</guid>
      <dc:creator>ScotchCat</dc:creator>
      <dc:date>2023-09-12T16:37:08Z</dc:date>
    </item>
  </channel>
</rss>

