<?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: Change dates to nearest month end in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Change-dates-to-nearest-month-end/m-p/649080#M194556</link>
    <description>&lt;P&gt;What do you want for&amp;nbsp;&lt;SPAN&gt;3/14/2020 or 2/15/2020 (leap month!), in terms of nearest date?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;IMO, using&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13976"&gt;@SASKiwi&lt;/a&gt;&amp;nbsp;suggestion of end of&amp;nbsp;the current month is a good&amp;nbsp;approach but&amp;nbsp;&lt;/SPAN&gt;different than what you seem to be requesting.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/287480"&gt;@anweinbe&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I have a column of dates. Is there a way to make a new field that returns the closest month end?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For example,&lt;/P&gt;
&lt;P&gt;Make 3/27/2020 -&amp;gt; 3/31/2020&lt;/P&gt;
&lt;P&gt;Make 1/28/2017 -&amp;gt; 1/31/2017&lt;/P&gt;
&lt;P&gt;etc.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My date field is currently a "date 9" format if that makes a difference!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 20 May 2020 03:26:05 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2020-05-20T03:26:05Z</dc:date>
    <item>
      <title>Change dates to nearest month end</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Change-dates-to-nearest-month-end/m-p/649057#M194540</link>
      <description>&lt;P&gt;I have a column of dates. Is there a way to make a new field that returns the closest month end?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For example,&lt;/P&gt;
&lt;P&gt;Make 3/27/2020 -&amp;gt; 3/31/2020&lt;/P&gt;
&lt;P&gt;Make 1/28/2017 -&amp;gt; 1/31/2017&lt;/P&gt;
&lt;P&gt;etc.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My date field is currently a "date 9" format if that makes a difference!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 May 2020 00:10:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Change-dates-to-nearest-month-end/m-p/649057#M194540</guid>
      <dc:creator>anweinbe</dc:creator>
      <dc:date>2020-05-20T00:10:19Z</dc:date>
    </item>
    <item>
      <title>Re: Change dates to nearest month end</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Change-dates-to-nearest-month-end/m-p/649069#M194548</link>
      <description>&lt;P&gt;On the assumption you are going forward to the nearest month-end:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
  My_Date = '27Mar2020'd;
  Month_End = intnx('MONTH', My_Date , 0, 'END');
  format My_Date Month_End date9.;
  put _all_;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 May 2020 00:45:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Change-dates-to-nearest-month-end/m-p/649069#M194548</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2020-05-20T00:45:56Z</dc:date>
    </item>
    <item>
      <title>Re: Change dates to nearest month end</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Change-dates-to-nearest-month-end/m-p/649080#M194556</link>
      <description>&lt;P&gt;What do you want for&amp;nbsp;&lt;SPAN&gt;3/14/2020 or 2/15/2020 (leap month!), in terms of nearest date?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;IMO, using&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13976"&gt;@SASKiwi&lt;/a&gt;&amp;nbsp;suggestion of end of&amp;nbsp;the current month is a good&amp;nbsp;approach but&amp;nbsp;&lt;/SPAN&gt;different than what you seem to be requesting.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/287480"&gt;@anweinbe&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I have a column of dates. Is there a way to make a new field that returns the closest month end?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For example,&lt;/P&gt;
&lt;P&gt;Make 3/27/2020 -&amp;gt; 3/31/2020&lt;/P&gt;
&lt;P&gt;Make 1/28/2017 -&amp;gt; 1/31/2017&lt;/P&gt;
&lt;P&gt;etc.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My date field is currently a "date 9" format if that makes a difference!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 May 2020 03:26:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Change-dates-to-nearest-month-end/m-p/649080#M194556</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-05-20T03:26:05Z</dc:date>
    </item>
    <item>
      <title>Re: Change dates to nearest month end</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Change-dates-to-nearest-month-end/m-p/649151#M194580</link>
      <description>&lt;P&gt;If I understand your requirement correctly, you want to map e.g. February 3rd into January 31st. How about this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  format date date9.;
  input date date9.;
cards;
03JAN2012
23DEC2019
15JAN2013
;run;

data want;
  set have;
  format date_eom date9.;
  date_eom=intnx('month',date,0,'E');
  if date_eom-date&amp;gt;day(date) then
    date_eom=intnx('month',date,-1,'E');
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 20 May 2020 09:59:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Change-dates-to-nearest-month-end/m-p/649151#M194580</guid>
      <dc:creator>s_lassen</dc:creator>
      <dc:date>2020-05-20T09:59:18Z</dc:date>
    </item>
    <item>
      <title>Re: Change dates to nearest month end</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Change-dates-to-nearest-month-end/m-p/649174#M194595</link>
      <description>&lt;P&gt;I believe that I will always be going forward not backwards. I should have specified that. In any case I will save this too! I appreciate your response :-).&lt;/P&gt;</description>
      <pubDate>Wed, 20 May 2020 11:29:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Change-dates-to-nearest-month-end/m-p/649174#M194595</guid>
      <dc:creator>anweinbe</dc:creator>
      <dc:date>2020-05-20T11:29:43Z</dc:date>
    </item>
  </channel>
</rss>

