<?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: Find the last day of the month in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Find-the-last-day-of-the-month/m-p/694751#M25144</link>
    <description>yes</description>
    <pubDate>Wed, 28 Oct 2020 07:45:23 GMT</pubDate>
    <dc:creator>SASlearner97</dc:creator>
    <dc:date>2020-10-28T07:45:23Z</dc:date>
    <item>
      <title>Find the last day of the month</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Find-the-last-day-of-the-month/m-p/694572#M25120</link>
      <description>&lt;P&gt;I have a daily data&amp;nbsp;&lt;/P&gt;&lt;P&gt;date&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; var&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; value&lt;/P&gt;&lt;P&gt;01/01/2013&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;a1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;27/10/2020&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;a3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;12&lt;/P&gt;&lt;P&gt;I want to get the data stored in the last day of each month for every year between the first date and the last date :&lt;/P&gt;&lt;P&gt;date&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; var&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; value&lt;/P&gt;&lt;P&gt;31/01/2013&amp;nbsp; &amp;nbsp; &amp;nbsp; a1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;5&lt;/P&gt;&lt;P&gt;28/02/2013&amp;nbsp; &amp;nbsp; &amp;nbsp; a2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;4&lt;/P&gt;&lt;P&gt;.....&lt;/P&gt;&lt;P&gt;27/10/2020&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;a3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;12&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i thought of making a call symput of the dates but i dont know how to&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;please help&lt;/P&gt;&lt;P&gt;thank you&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Oct 2020 13:55:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Find-the-last-day-of-the-month/m-p/694572#M25120</guid>
      <dc:creator>SASlearner97</dc:creator>
      <dc:date>2020-10-27T13:55:57Z</dc:date>
    </item>
    <item>
      <title>Re: Find the last day of the month</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Find-the-last-day-of-the-month/m-p/694573#M25121</link>
      <description>&lt;P&gt;CALL SYMPUT has nothing to do with this. You need the INTNX function to get the last day of the month.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Something like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;last_day_of_month=intnx('month',date,0,'e');
format last_day_of_month ddmmyys10.;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I don't understand why your input data doesn't match your output. In the Input data, your last value is 27/10/2020 while the output data has as its last value 30/09/2020.&lt;/P&gt;</description>
      <pubDate>Tue, 27 Oct 2020 13:39:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Find-the-last-day-of-the-month/m-p/694573#M25121</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-10-27T13:39:31Z</dc:date>
    </item>
    <item>
      <title>Re: Find the last day of the month</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Find-the-last-day-of-the-month/m-p/694575#M25122</link>
      <description>Thanks for your feedback&lt;BR /&gt;&lt;BR /&gt;you are right i will edit the question;&lt;BR /&gt;&lt;BR /&gt;actually i want to get the data stored in these dates ...&lt;BR /&gt;</description>
      <pubDate>Tue, 27 Oct 2020 13:44:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Find-the-last-day-of-the-month/m-p/694575#M25122</guid>
      <dc:creator>SASlearner97</dc:creator>
      <dc:date>2020-10-27T13:44:51Z</dc:date>
    </item>
    <item>
      <title>Re: Find the last day of the month</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Find-the-last-day-of-the-month/m-p/694576#M25123</link>
      <description>&lt;P&gt;You weren't clear about the environment in which you want to do this.&amp;nbsp; Does this come close?&amp;nbsp; The Macro could be eliminated.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro EOM(firstdata,lastdate);
  data dates;
    format date date9.;
    date = intnx("MONTH",input("&amp;amp;firstdata",date9.),0,"end");
    do until (date &amp;gt; input("&amp;amp;lastdate",date9.));
      output;
      date = intnx("MONTH",date,1,"end");
    end;
  run;
%mend;
%EOM(05JAN2020,14JUN2020);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 27 Oct 2020 13:46:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Find-the-last-day-of-the-month/m-p/694576#M25123</guid>
      <dc:creator>CurtisMackWSIPP</dc:creator>
      <dc:date>2020-10-27T13:46:05Z</dc:date>
    </item>
    <item>
      <title>Re: Find the last day of the month</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Find-the-last-day-of-the-month/m-p/694578#M25124</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/353308"&gt;@SASlearner97&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Thanks for your feedback&lt;BR /&gt;&lt;BR /&gt;you are right i will edit the question;&lt;BR /&gt;&lt;BR /&gt;actually i want to get the data stored in these dates ...&lt;BR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Sorry, not clear what you mean with the last sentence. &lt;STRONG&gt;Please don't edit your initial post&lt;/STRONG&gt; as this makes it impossible to understand all the answers given before the change.&lt;/P&gt;</description>
      <pubDate>Tue, 27 Oct 2020 13:50:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Find-the-last-day-of-the-month/m-p/694578#M25124</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2020-10-27T13:50:16Z</dc:date>
    </item>
    <item>
      <title>Re: Find the last day of the month</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Find-the-last-day-of-the-month/m-p/694579#M25125</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/353308"&gt;@SASlearner97&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Thanks for your feedback&lt;BR /&gt;&lt;BR /&gt;you are right i will edit the question;&lt;BR /&gt;&lt;BR /&gt;actually i want to get the data stored in these dates ...&lt;BR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Now that you have edited the output data, the last value in the output data is NOT the last day of a month. Could you please explain?&lt;/P&gt;</description>
      <pubDate>Tue, 27 Oct 2020 13:53:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Find-the-last-day-of-the-month/m-p/694579#M25125</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-10-27T13:53:42Z</dc:date>
    </item>
    <item>
      <title>Re: Find the last day of the month</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Find-the-last-day-of-the-month/m-p/694581#M25126</link>
      <description>i have a table of daily data&lt;BR /&gt;&lt;BR /&gt;i want to select the data of only the end of months for each year</description>
      <pubDate>Tue, 27 Oct 2020 14:02:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Find-the-last-day-of-the-month/m-p/694581#M25126</guid>
      <dc:creator>SASlearner97</dc:creator>
      <dc:date>2020-10-27T14:02:59Z</dc:date>
    </item>
    <item>
      <title>Re: Find the last day of the month</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Find-the-last-day-of-the-month/m-p/694582#M25127</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/353308"&gt;@SASlearner97&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;BR /&gt;i want to select the data of only the end of months for each year&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;But your output (as modified by you earlier) doesn't do this. It shows 27/10/2020&lt;/P&gt;</description>
      <pubDate>Tue, 27 Oct 2020 14:05:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Find-the-last-day-of-the-month/m-p/694582#M25127</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-10-27T14:05:39Z</dc:date>
    </item>
    <item>
      <title>Re: Find the last day of the month</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Find-the-last-day-of-the-month/m-p/694585#M25128</link>
      <description>27/10/2020 is the last day of month in this example&lt;BR /&gt;&lt;BR /&gt;thats why It shows 27/10/2020</description>
      <pubDate>Tue, 27 Oct 2020 14:15:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Find-the-last-day-of-the-month/m-p/694585#M25128</guid>
      <dc:creator>SASlearner97</dc:creator>
      <dc:date>2020-10-27T14:15:03Z</dc:date>
    </item>
    <item>
      <title>Re: Find the last day of the month</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Find-the-last-day-of-the-month/m-p/694586#M25129</link>
      <description>i have a table of daily data&lt;BR /&gt;&lt;BR /&gt;i want to select the data of only the end of months for each year&lt;BR /&gt;&lt;BR /&gt;the ends of months maybe 28/03/2015&lt;BR /&gt;31/12/2015&lt;BR /&gt;30/04/2016 ..&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 27 Oct 2020 14:17:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Find-the-last-day-of-the-month/m-p/694586#M25129</guid>
      <dc:creator>SASlearner97</dc:creator>
      <dc:date>2020-10-27T14:17:13Z</dc:date>
    </item>
    <item>
      <title>Re: Find the last day of the month</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Find-the-last-day-of-the-month/m-p/694588#M25130</link>
      <description>&lt;P&gt;yes it comes close&lt;BR /&gt;&lt;BR /&gt;my table got some months that ends in 27 or less .. like i have 29/12/2011 for some var&lt;BR /&gt;&lt;BR /&gt;how to find the ends of months of dates in my table please&lt;BR /&gt;&lt;BR /&gt;Thank you&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Oct 2020 14:27:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Find-the-last-day-of-the-month/m-p/694588#M25130</guid>
      <dc:creator>SASlearner97</dc:creator>
      <dc:date>2020-10-27T14:27:47Z</dc:date>
    </item>
    <item>
      <title>Re: Find the last day of the month</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Find-the-last-day-of-the-month/m-p/694595#M25131</link>
      <description>&lt;P&gt;And what is the rule for months that do not end on the last calendar day of that month, but a previous day?&lt;/P&gt;</description>
      <pubDate>Tue, 27 Oct 2020 14:39:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Find-the-last-day-of-the-month/m-p/694595#M25131</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-10-27T14:39:30Z</dc:date>
    </item>
    <item>
      <title>Re: Find the last day of the month</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Find-the-last-day-of-the-month/m-p/694738#M25141</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/353308"&gt;@SASlearner97&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;i have a table of daily data&lt;BR /&gt;&lt;BR /&gt;i want to select the data of only the end of months for each year&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;So you want to select the all observations having date = max(date) by month/year?&lt;/P&gt;</description>
      <pubDate>Wed, 28 Oct 2020 05:17:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Find-the-last-day-of-the-month/m-p/694738#M25141</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2020-10-28T05:17:14Z</dc:date>
    </item>
    <item>
      <title>Re: Find the last day of the month</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Find-the-last-day-of-the-month/m-p/694751#M25144</link>
      <description>yes</description>
      <pubDate>Wed, 28 Oct 2020 07:45:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Find-the-last-day-of-the-month/m-p/694751#M25144</guid>
      <dc:creator>SASlearner97</dc:creator>
      <dc:date>2020-10-28T07:45:23Z</dc:date>
    </item>
    <item>
      <title>Re: Find the last day of the month</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Find-the-last-day-of-the-month/m-p/694760#M25145</link>
      <description>&lt;P&gt;Try something like:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data bob;
  set have;
  group_date = intnx('MONTH', date, 0 'b');
run;

proc sort data=bob;
  by group_date date;
run;

data want;
  set bob;
  by group_date date;
  if last.date;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you want tested code, post data in usable form (data step with datalines, no attachments).&lt;/P&gt;</description>
      <pubDate>Wed, 28 Oct 2020 08:29:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Find-the-last-day-of-the-month/m-p/694760#M25145</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2020-10-28T08:29:32Z</dc:date>
    </item>
    <item>
      <title>Re: Find the last day of the month</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Find-the-last-day-of-the-month/m-p/694838#M25148</link>
      <description>&lt;P&gt;I'm late coming into this discussion, but it appears to me that you want the last &lt;EM&gt;&lt;STRONG&gt;observed&lt;/STRONG&gt;&lt;/EM&gt; date in each month, which I interpret differently than the ordinary last date.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If so, then you can run a program that looks ahead one record to see if the next record is in a different month than the current record:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data=have out=need;
  by date;
run;

data want (drop=nxt_date);
  merge need
        need (firstobs=2 keep=date rename=(date=nxt_date));
  if intck('month',date,nxt_date);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If your original dataset (named "have" here) is already sorted, skip the proc sort, and apply the merge statement to have instead of need.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The merge statement combines each observation with a single, renamed variable (date=nxt_date)&amp;nbsp; from the following observation (that's from the "firstobs=2" parameter).&amp;nbsp; This allows the intck function to count the number of months between date and nxt_date.&amp;nbsp; Only non-zero results pass the filter - yielding the last observed date of the month.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Oct 2020 12:57:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Find-the-last-day-of-the-month/m-p/694838#M25148</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2020-10-28T12:57:01Z</dc:date>
    </item>
    <item>
      <title>Re: Find the last day of the month</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Find-the-last-day-of-the-month/m-p/694863#M25149</link>
      <description>Thank you so much&lt;BR /&gt;&lt;BR /&gt;in my var column i have 4 kinds of observations like :&lt;BR /&gt;&lt;BR /&gt;var&lt;BR /&gt;a1&lt;BR /&gt;a2&lt;BR /&gt;a3&lt;BR /&gt;a4&lt;BR /&gt;....&lt;BR /&gt;&lt;BR /&gt;when i tried your code it went like :&lt;BR /&gt;var date&lt;BR /&gt;a1 31/01/2013&lt;BR /&gt;a1&lt;BR /&gt;a1&lt;BR /&gt;a1&lt;BR /&gt;...&lt;BR /&gt;the dates are correct but the column var is wrong ..</description>
      <pubDate>Wed, 28 Oct 2020 13:59:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Find-the-last-day-of-the-month/m-p/694863#M25149</guid>
      <dc:creator>SASlearner97</dc:creator>
      <dc:date>2020-10-28T13:59:00Z</dc:date>
    </item>
    <item>
      <title>Re: Find the last day of the month</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Find-the-last-day-of-the-month/m-p/695303#M25170</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/353308"&gt;@SASlearner97&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Thank you so much&lt;BR /&gt;&lt;BR /&gt;in my var column i have 4 kinds of observations like :&lt;BR /&gt;&lt;BR /&gt;var&lt;BR /&gt;a1&lt;BR /&gt;a2&lt;BR /&gt;a3&lt;BR /&gt;a4&lt;BR /&gt;....&lt;BR /&gt;&lt;BR /&gt;when i tried your code it went like :&lt;BR /&gt;var date&lt;BR /&gt;a1 31/01/2013&lt;BR /&gt;a1&lt;BR /&gt;a1&lt;BR /&gt;a1&lt;BR /&gt;...&lt;BR /&gt;the dates are correct but the column var is wrong ..&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Then I don't understand what you want, and probably I don't understand what you are starting with.&amp;nbsp; Please provide, in the form of a SAS data step, a sample of the data you are starting with (call it data set HAVE), and a sample of what it should provide, also in the from of a data step.&amp;nbsp; Then I can provide code to work with what you have, as opposed to guessing what you have.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Help us help you.&lt;/P&gt;</description>
      <pubDate>Thu, 29 Oct 2020 18:25:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Find-the-last-day-of-the-month/m-p/695303#M25170</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2020-10-29T18:25:31Z</dc:date>
    </item>
  </channel>
</rss>

