<?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 Find the last day of the month in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Find-the-last-day-of-the-month/m-p/65751#M6608</link>
    <description>I want to find, &lt;B&gt;in entreprise guide&lt;/B&gt;, the last day of the month. I only have a string who represent the month and the year (e.q : "200908") I want to compute a real date ==&amp;gt; "08/31/2009". Is anyone can help me.&lt;BR /&gt;
&lt;BR /&gt;
Best regards.</description>
    <pubDate>Thu, 20 Aug 2009 11:58:03 GMT</pubDate>
    <dc:creator>Droopy</dc:creator>
    <dc:date>2009-08-20T11:58:03Z</dc:date>
    <item>
      <title>Find the last day of the month</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Find-the-last-day-of-the-month/m-p/65751#M6608</link>
      <description>I want to find, &lt;B&gt;in entreprise guide&lt;/B&gt;, the last day of the month. I only have a string who represent the month and the year (e.q : "200908") I want to compute a real date ==&amp;gt; "08/31/2009". Is anyone can help me.&lt;BR /&gt;
&lt;BR /&gt;
Best regards.</description>
      <pubDate>Thu, 20 Aug 2009 11:58:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Find-the-last-day-of-the-month/m-p/65751#M6608</guid>
      <dc:creator>Droopy</dc:creator>
      <dc:date>2009-08-20T11:58:03Z</dc:date>
    </item>
    <item>
      <title>Re: Find the last day of the month</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Find-the-last-day-of-the-month/m-p/65752#M6609</link>
      <description>try this sample program:&lt;BR /&gt;
&lt;BR /&gt;
data _null_;&lt;BR /&gt;
 a = '200901';&lt;BR /&gt;
 b = intnx('month',input(a,yymmn6.),0,'end');&lt;BR /&gt;
 put b yymmdd10.;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
In EG use the expression (intnx('month',input(a,yymmn6.),0,'end')) to create a new variable.&lt;BR /&gt;
&lt;BR /&gt;
//Fredrik</description>
      <pubDate>Thu, 20 Aug 2009 12:04:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Find-the-last-day-of-the-month/m-p/65752#M6609</guid>
      <dc:creator>FredrikE</dc:creator>
      <dc:date>2009-08-20T12:04:14Z</dc:date>
    </item>
    <item>
      <title>Re: Find the last day of the month</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Find-the-last-day-of-the-month/m-p/65753#M6610</link>
      <description>Hi Droopy,&lt;BR /&gt;
&lt;BR /&gt;
To do this, I would convert your text string to a normal date, then make use of the INTNX function to go forward a month, then back a day.&lt;BR /&gt;
&lt;BR /&gt;
For example, 200908 would be converted to 08/01/2009 (sticking with US style dates).  Jump forward a month to 09/01/2009, then go back a day to 08/31/2009.&lt;BR /&gt;
&lt;BR /&gt;
The below code create a sample dataset with months stored as text, and then does the above calculation.&lt;BR /&gt;
&lt;BR /&gt;
data months;&lt;BR /&gt;
format month $10.;&lt;BR /&gt;
input month $;&lt;BR /&gt;
datalines;&lt;BR /&gt;
200002&lt;BR /&gt;
200908&lt;BR /&gt;
200402&lt;BR /&gt;
;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
data months;&lt;BR /&gt;
set months;&lt;BR /&gt;
format last_day date9.;&lt;BR /&gt;
last_day = intnx('day',intnx('month',input(month,yymmn6.),1),-1);&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
The Input function converts the text date to its numerical equivalent, then intnx is used as above.&lt;BR /&gt;
&lt;BR /&gt;
Hope that helps.</description>
      <pubDate>Thu, 20 Aug 2009 12:09:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Find-the-last-day-of-the-month/m-p/65753#M6610</guid>
      <dc:creator>DF</dc:creator>
      <dc:date>2009-08-20T12:09:05Z</dc:date>
    </item>
    <item>
      <title>Re: Find the last day of the month</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Find-the-last-day-of-the-month/m-p/65754#M6611</link>
      <description>Oops - double response.  That's what I get for being slow, lol.</description>
      <pubDate>Thu, 20 Aug 2009 12:11:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Find-the-last-day-of-the-month/m-p/65754#M6611</guid>
      <dc:creator>DF</dc:creator>
      <dc:date>2009-08-20T12:11:10Z</dc:date>
    </item>
    <item>
      <title>Re: Find the last day of the month</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Find-the-last-day-of-the-month/m-p/65755#M6612</link>
      <description>Thanks all. It's work !!! &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;</description>
      <pubDate>Thu, 20 Aug 2009 12:41:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Find-the-last-day-of-the-month/m-p/65755#M6612</guid>
      <dc:creator>Droopy</dc:creator>
      <dc:date>2009-08-20T12:41:32Z</dc:date>
    </item>
  </channel>
</rss>

