<?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: each month no of days in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/each-month-no-of-days/m-p/874378#M345466</link>
    <description>&lt;P&gt;Hi PGstats,&lt;/P&gt;
&lt;P&gt;Thank you very much for solution&lt;/P&gt;</description>
    <pubDate>Mon, 08 May 2023 03:09:19 GMT</pubDate>
    <dc:creator>BrahmanandaRao</dc:creator>
    <dc:date>2023-05-08T03:09:19Z</dc:date>
    <item>
      <title>each month no of days</title>
      <link>https://communities.sas.com/t5/SAS-Programming/each-month-no-of-days/m-p/874324#M345427</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data noofdays;
do i=1 to 12;
st='01jan2010'd ;
ed='01dec2010'd;
eom=intnx('month',st,ed,'e');
numdays=day(eom);
output;
end;
format st ed eom:date9.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;count each month number of days in do loop&lt;/P&gt;</description>
      <pubDate>Sun, 07 May 2023 11:19:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/each-month-no-of-days/m-p/874324#M345427</guid>
      <dc:creator>BrahmanandaRao</dc:creator>
      <dc:date>2023-05-07T11:19:23Z</dc:date>
    </item>
    <item>
      <title>Re: each month no of days</title>
      <link>https://communities.sas.com/t5/SAS-Programming/each-month-no-of-days/m-p/874326#M345429</link>
      <description>&lt;P&gt;What is your question?&lt;/P&gt;</description>
      <pubDate>Sun, 07 May 2023 12:05:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/each-month-no-of-days/m-p/874326#M345429</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-05-07T12:05:02Z</dc:date>
    </item>
    <item>
      <title>Re: each month no of days</title>
      <link>https://communities.sas.com/t5/SAS-Programming/each-month-no-of-days/m-p/874327#M345430</link>
      <description>&lt;P&gt;You repeat the identical calculation 12 times. You may want to use i somewhere in that calculation &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 07 May 2023 12:26:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/each-month-no-of-days/m-p/874327#M345430</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2023-05-07T12:26:43Z</dc:date>
    </item>
    <item>
      <title>Re: each month no of days</title>
      <link>https://communities.sas.com/t5/SAS-Programming/each-month-no-of-days/m-p/874330#M345433</link>
      <description>&lt;P&gt;As mentioned in the previous posts, if you're using a loop, you need to include that in your INTNX() call.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Since iteration value is represented by `i`, you need to include that in the third argument.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data noofdays;
do i=1 to 12;
st='01jan2010'd ;
ed='01dec2010'd;
/* Putting the `i` in the third argument */
eom=intnx('month',st,i,'e');
numdays=day(eom);
output;
end;
format st ed eom:date9.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This will increment the loop each time by the iteration value specified for a specified interval.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Looking at your original output, you will see that you get dates that are far away in the future. This is because your third argument is a SAS date which is internally represented as a number.&lt;/P&gt;</description>
      <pubDate>Sun, 07 May 2023 13:36:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/each-month-no-of-days/m-p/874330#M345433</guid>
      <dc:creator>maguiremq</dc:creator>
      <dc:date>2023-05-07T13:36:22Z</dc:date>
    </item>
    <item>
      <title>Re: each month no of days</title>
      <link>https://communities.sas.com/t5/SAS-Programming/each-month-no-of-days/m-p/874349#M345444</link>
      <description>&lt;P&gt;MDY : create a SAS date from year, month and day; INTNX : count the number of date intervals between SAS dates; INTNX : find a SAS date a given number of intervals from a given date. Combine those to your purpose :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data nbOfDays;
year = 2010;
do month = 1 to 12;
    numdays = 1 + intck("DAY", mdy(month, 1, year), intnx("MONTH", mdy(month, 1, year), 0, "END"));
    output;
    end;
run;

proc print data=nbOfDays; run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="PGStats_0-1683483413324.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/83675i7E5D4E92F5B66E07/image-size/medium?v=v2&amp;amp;px=400" role="button" title="PGStats_0-1683483413324.png" alt="PGStats_0-1683483413324.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 07 May 2023 18:18:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/each-month-no-of-days/m-p/874349#M345444</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2023-05-07T18:18:11Z</dc:date>
    </item>
    <item>
      <title>Re: each month no of days</title>
      <link>https://communities.sas.com/t5/SAS-Programming/each-month-no-of-days/m-p/874354#M345449</link>
      <description>&lt;P&gt;Just use the DAY() function to find the day of month of the last day of the month.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data noofdays;
  do year=2010 to 2010;
    do month=1 to 12 ;
      eom=intnx('month',mdy(month,1,year),0,'end');
      numdays=day(eom);
      output;
    end;
  end;
  format eom date9.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;Obs    year    month          eom    numdays

  1    2010       1     31JAN2010       31
  2    2010       2     28FEB2010       28
  3    2010       3     31MAR2010       31
  4    2010       4     30APR2010       30
  5    2010       5     31MAY2010       31
  6    2010       6     30JUN2010       30
  7    2010       7     31JUL2010       31
  8    2010       8     31AUG2010       31
  9    2010       9     30SEP2010       30
 10    2010      10     31OCT2010       31
 11    2010      11     30NOV2010       30
 12    2010      12     31DEC2010       31
&lt;/PRE&gt;</description>
      <pubDate>Sun, 07 May 2023 20:44:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/each-month-no-of-days/m-p/874354#M345449</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-05-07T20:44:00Z</dc:date>
    </item>
    <item>
      <title>Re: each month no of days</title>
      <link>https://communities.sas.com/t5/SAS-Programming/each-month-no-of-days/m-p/874378#M345466</link>
      <description>&lt;P&gt;Hi PGstats,&lt;/P&gt;
&lt;P&gt;Thank you very much for solution&lt;/P&gt;</description>
      <pubDate>Mon, 08 May 2023 03:09:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/each-month-no-of-days/m-p/874378#M345466</guid>
      <dc:creator>BrahmanandaRao</dc:creator>
      <dc:date>2023-05-08T03:09:19Z</dc:date>
    </item>
    <item>
      <title>Re: each month no of days</title>
      <link>https://communities.sas.com/t5/SAS-Programming/each-month-no-of-days/m-p/874379#M345467</link>
      <description>&lt;P&gt;Hi Mag&lt;/P&gt;
&lt;P&gt;Thank you very much for solution&lt;/P&gt;</description>
      <pubDate>Mon, 08 May 2023 03:10:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/each-month-no-of-days/m-p/874379#M345467</guid>
      <dc:creator>BrahmanandaRao</dc:creator>
      <dc:date>2023-05-08T03:10:55Z</dc:date>
    </item>
  </channel>
</rss>

