<?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: days in month between two dates in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/days-in-month-between-two-dates/m-p/640762#M78289</link>
    <description>&lt;P&gt;You may also want to check out the SAS financial functions.&lt;/P&gt;
&lt;P&gt;I suspect that any approach that was going to use days in the manner implied may have been completely writing the interest calculations.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;One function actually name FINANCE takes as the first parameter what type of calculation is involved.&lt;/P&gt;
&lt;P&gt;Others like CUMIPMT, cumulative interest paid on a loan, IPMT interest payment for a given period and others.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Plus if you have&amp;nbsp; SAS/ETS there is Proc Loan and other goodies&lt;/P&gt;</description>
    <pubDate>Fri, 17 Apr 2020 15:09:36 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2020-04-17T15:09:36Z</dc:date>
    <item>
      <title>days in month between two dates</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/days-in-month-between-two-dates/m-p/640567#M78268</link>
      <description>&lt;P&gt;hi i am looking to create macro with days in month like( 30,31,30) from two dates. which i will use later in array as macro like(array days_mnt{6} 8 _temporary_( &amp;amp;daycount.);) any suggestions please. thanks&lt;/P&gt;</description>
      <pubDate>Thu, 16 Apr 2020 21:21:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/days-in-month-between-two-dates/m-p/640567#M78268</guid>
      <dc:creator>SASUser0001</dc:creator>
      <dc:date>2020-04-16T21:21:10Z</dc:date>
    </item>
    <item>
      <title>Re: days in month between two dates</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/days-in-month-between-two-dates/m-p/640569#M78269</link>
      <description>&lt;P&gt;How are you providing the end dates, i.e. start and end dates?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also how will expect to use that value? You can always get the number of days in a given month for a SAS date value with&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;days = day(intnx('month',date,0,'e'));&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;day function returns the day of month, the intnx function shown advances any given date to the end of the month.&lt;/P&gt;</description>
      <pubDate>Thu, 16 Apr 2020 21:28:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/days-in-month-between-two-dates/m-p/640569#M78269</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-04-16T21:28:48Z</dc:date>
    </item>
    <item>
      <title>Re: days in month between two dates</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/days-in-month-between-two-dates/m-p/640570#M78270</link>
      <description>&lt;P&gt;&amp;nbsp;hi I have data like this&lt;/P&gt;&lt;P&gt;start_date=01apr2020&lt;/P&gt;&lt;P&gt;end_date=30sep2020&lt;/P&gt;&lt;P&gt;and I am looking to create macro which will provide me daycount(30,31,30,31,30) so I can use this later in array as below. thanks for guiding&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="1" color="#0000ff"&gt;array&lt;/FONT&gt;&lt;FONT face="Courier New" size="1"&gt; days_mnt{&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="1" color="#008080"&gt;6&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="1"&gt;} &lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="1" color="#008080"&gt;8&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT face="Courier New" size="1" color="#0000ff"&gt;_temporary_&lt;/FONT&gt;&lt;FONT face="Courier New" size="1"&gt;( &amp;amp;&lt;/FONT&gt;&lt;FONT face="Courier New" size="1" color="#008080"&gt;daycount.&lt;/FONT&gt;&lt;FONT face="Courier New" size="1"&gt;);&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Apr 2020 21:36:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/days-in-month-between-two-dates/m-p/640570#M78270</guid>
      <dc:creator>SASUser0001</dc:creator>
      <dc:date>2020-04-16T21:36:27Z</dc:date>
    </item>
    <item>
      <title>Re: days in month between two dates</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/days-in-month-between-two-dates/m-p/640575#M78271</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/322738"&gt;@SASUser0001&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&amp;nbsp;hi I have data like this&lt;/P&gt;
&lt;P&gt;start_date=01apr2020&lt;/P&gt;
&lt;P&gt;end_date=30sep2020&lt;/P&gt;
&lt;P&gt;and I am looking to create macro which will provide me daycount(30,31,30,31,30) so I can use this later in array as below. thanks for guiding&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="1" color="#0000ff"&gt;array&lt;/FONT&gt;&lt;FONT face="Courier New" size="1"&gt; days_mnt{&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="1" color="#008080"&gt;6&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="1"&gt;} &lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="1" color="#008080"&gt;8&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT face="Courier New" size="1" color="#0000ff"&gt;_temporary_&lt;/FONT&gt;&lt;FONT face="Courier New" size="1"&gt;( &amp;amp;&lt;/FONT&gt;&lt;FONT face="Courier New" size="1" color="#008080"&gt;daycount.&lt;/FONT&gt;&lt;FONT face="Courier New" size="1"&gt;);&lt;/FONT&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;And just how are you going to use that array? It may not be needed. There are a number of SAS functions for dealing with date values and almost anything I can imagine wanting a not very well defined array of days in month is generally covered in one of the SAS functions.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;INTNX will increment dates, times or datetime values by intervals such as week, month, quarter and year plus multiples and shifts of those (or with time values hours, minutes, and seconds)&lt;/P&gt;
&lt;P&gt;The INTCK function returns the number of intervals between two values.&lt;/P&gt;
&lt;P&gt;Functions like Year, Month, Day, Hour, and such extract those values from a date or time value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Apr 2020 22:01:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/days-in-month-between-two-dates/m-p/640575#M78271</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-04-16T22:01:10Z</dc:date>
    </item>
    <item>
      <title>Re: days in month between two dates</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/days-in-month-between-two-dates/m-p/640581#M78273</link>
      <description>&lt;P&gt;so basically I am looking to calculate interest for 6 months , each record start date and end date is different I have created array to calculate interest and now I am looking to create macro for days in each month for 6 months . so for each record (1 to 6 months ) interest will be calculated based on month.&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="1"&gt;ints_1=&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="1"&gt;((balance *Interest_rate )/&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="1" color="#008080"&gt;100&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="1"&gt;)/&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="1" color="#008080"&gt;365&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="1"&gt;)*31; &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;bal = balance + ints_1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;so trying to replace days in month (31) with actual days in month by using data _null_step or macro&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;</description>
      <pubDate>Thu, 16 Apr 2020 23:21:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/days-in-month-between-two-dates/m-p/640581#M78273</guid>
      <dc:creator>SASUser0001</dc:creator>
      <dc:date>2020-04-16T23:21:22Z</dc:date>
    </item>
    <item>
      <title>Re: days in month between two dates</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/days-in-month-between-two-dates/m-p/640593#M78278</link>
      <description>&lt;P&gt;April, May, June, July, August, September&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That is 6 months, why do you have only 5 entries?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As others have mentioned this isn't a great approach. There are better ways to include that calculation into the loop below itself, rather than separate it into separate steps. But there's an answer for you at least.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;and I am looking to create macro which will provide me daycount&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;(30,31,30,31,30)&lt;/STRONG&gt;&lt;/FONT&gt; so I can use this later in array as below. thanks for guiding&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data demo;
	length days_list $40.;
	*starting dates;
	start_date='01apr2020'd;
	end_date='30sep2020'd;
	*calculate number of months between intervals;
	nMonths=intck('month', start_date, end_date, 'C');
	*assign to new variable that can be incremented;
	month_start=start_date;
	*loop over Number of months;

	do i=1 to nMonths+1;
		*get the month end;
		month_end=intnx('month', month_start, 1, 'b');
		*calcuate the number of days;
		nDays=month_end - month_start;
		*add value to the days list;
		days_list=catx(', ', days_list, nDays);
		*output to data set - optional;
		output;
		*set start to new month;
		month_start=month_end;
	end;
	
	*create macro variable for later usage or put interest calculation into loop above;
	call symputx('ndays_list', days_list, 'g');
	format month: start_date end_date date9.;
run;

%put &amp;amp;ndays_list;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 17 Apr 2020 01:40:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/days-in-month-between-two-dates/m-p/640593#M78278</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-04-17T01:40:15Z</dc:date>
    </item>
    <item>
      <title>Re: days in month between two dates</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/days-in-month-between-two-dates/m-p/640596#M78280</link>
      <description>&lt;P&gt;Thanks you been most helpful&lt;/P&gt;</description>
      <pubDate>Fri, 17 Apr 2020 02:11:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/days-in-month-between-two-dates/m-p/640596#M78280</guid>
      <dc:creator>SASUser0001</dc:creator>
      <dc:date>2020-04-17T02:11:54Z</dc:date>
    </item>
    <item>
      <title>Re: days in month between two dates</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/days-in-month-between-two-dates/m-p/640762#M78289</link>
      <description>&lt;P&gt;You may also want to check out the SAS financial functions.&lt;/P&gt;
&lt;P&gt;I suspect that any approach that was going to use days in the manner implied may have been completely writing the interest calculations.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;One function actually name FINANCE takes as the first parameter what type of calculation is involved.&lt;/P&gt;
&lt;P&gt;Others like CUMIPMT, cumulative interest paid on a loan, IPMT interest payment for a given period and others.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Plus if you have&amp;nbsp; SAS/ETS there is Proc Loan and other goodies&lt;/P&gt;</description>
      <pubDate>Fri, 17 Apr 2020 15:09:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/days-in-month-between-two-dates/m-p/640762#M78289</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-04-17T15:09:36Z</dc:date>
    </item>
    <item>
      <title>Re: days in month between two dates</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/days-in-month-between-two-dates/m-p/640779#M78290</link>
      <description>&lt;P&gt;It does not sound like you want either a macro variable or a macro program.&amp;nbsp; The actual calculation of days in a month and interest should be done in actual SAS code, not in macro code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Once you have it working you can think about whether any of it would benefit from being generated by a macro variable reference or some macro logic.&lt;/P&gt;</description>
      <pubDate>Fri, 17 Apr 2020 16:56:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/days-in-month-between-two-dates/m-p/640779#M78290</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-04-17T16:56:16Z</dc:date>
    </item>
  </channel>
</rss>

