<?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: Getting a count for a specific date range in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Getting-a-count-for-a-specific-date-range/m-p/507234#M136109</link>
    <description>&lt;P&gt;Did you add the mid/product/vendor to the group by statement?&lt;/P&gt;</description>
    <pubDate>Wed, 24 Oct 2018 16:49:49 GMT</pubDate>
    <dc:creator>DBailey</dc:creator>
    <dc:date>2018-10-24T16:49:49Z</dc:date>
    <item>
      <title>Getting a count for a specific date range</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Getting-a-count-for-a-specific-date-range/m-p/506855#M135898</link>
      <description>&lt;P&gt;I have a dataset that I created that pulls in data over a 13 month period. I am pulling a list of unique keys and dates, and I am getting a count of the keys within a given day.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The issue im running into when getting a count is that I need the count for each month to go from the 25th through the 25th of every month.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example: I need a count of all of the keys from Jan 25th 2018 through&amp;nbsp;February 25th 2018, and I need the data step in sas to recognize this as the count for&amp;nbsp;the month of February.&amp;nbsp; This pattern continues every month going forward.&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Nov 2018 20:14:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Getting-a-count-for-a-specific-date-range/m-p/506855#M135898</guid>
      <dc:creator>aperansi</dc:creator>
      <dc:date>2018-11-27T20:14:29Z</dc:date>
    </item>
    <item>
      <title>Re: Getting a count for a specific date range</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Getting-a-count-for-a-specific-date-range/m-p/506866#M135907</link>
      <description>&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;The issue im running into when getting a count is that I need the count for each month to go from the 25th through the 25th of every month.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;This seems like an incomplete explanation. What is stopping you from obtaining this count?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;and I need the data step in sas to recognize this as the count for&amp;nbsp;the month of February.&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Find the maximum date in the data step and assign the month of that maximum date to a variable in this data set. Or, do this in PROC SQL when you extract the data.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Oct 2018 15:04:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Getting-a-count-for-a-specific-date-range/m-p/506866#M135907</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2018-10-23T15:04:01Z</dc:date>
    </item>
    <item>
      <title>Re: Getting a count for a specific date range</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Getting-a-count-for-a-specific-date-range/m-p/506879#M135916</link>
      <description>&lt;P&gt;Here's some logic you can use, to create a new variable:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if day(api_date) &amp;lt; 25 then counting_date = intnx('month', api_date, -1);&lt;/P&gt;
&lt;P&gt;else counting_date = intnx('month', api_date, 0);&lt;/P&gt;
&lt;P&gt;format counting_date yymmd7.;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The new variable is a the first day of the month that should be used to count that observation.&amp;nbsp; The format statement prints that variable in a suitable format, such as:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2018-02&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It's not clear if you meant &amp;lt; 25 or &amp;lt;= 25.&amp;nbsp; I don't think you would want the 25th day of the month to be counted in two different months.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Oct 2018 15:36:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Getting-a-count-for-a-specific-date-range/m-p/506879#M135916</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-10-23T15:36:38Z</dc:date>
    </item>
    <item>
      <title>Re: Getting a count for a specific date range</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Getting-a-count-for-a-specific-date-range/m-p/506882#M135918</link>
      <description>&lt;P&gt;You should be able to modify this to meet your needs...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input api_date:mmddyy10. api_count;
format api_date mmddyy10. api_count 8.0;
datalines;
1/1/2017 125
8/2/2017 126
8/3/2017 127
8/4/2017 128
8/5/2017 129
8/6/2017 130
8/7/2017 131
8/8/2017 132
8/9/2017 133
8/10/2017 134
8/11/2017 135
8/12/2017 136
8/13/2017 137
8/14/2017 138
8/15/2017 139
8/16/2017 140
8/17/2017 141
8/18/2017 142
8/19/2017 143
8/20/2017 144
8/21/2017 145
8/22/2017 146
8/23/2017 147
8/24/2017 148
8/25/2017 149
8/26/2017 150
8/27/2017 151
8/28/2017 152
8/29/2017 153
8/30/2017 154
8/31/2017 155
9/1/2017 156
9/2/2017 157
9/3/2017 158
9/4/2017 159
9/5/2017 160
9/6/2017 161
;
run;

proc sql;
create table want as select		
	intnx('month',api_date,case when day(api_date)&amp;gt;=25 then 1 else 0 end,'begin') format mmddyy10. as  Period,
	intnx('month',api_date,case when day(api_date)&amp;gt;=25 then 0 else - 1 end,'begin')+24 format mmddyy10. as PeriodStart,
	intnx('month',api_date,case when day(api_date)&amp;gt;=25 then 1 else 0 end,'begin')+23 format mmddyy10. as PeriodEnd
	,sum(api_count) as Total_API_Count
from	
	have
group by
	calculated period
	,calculated periodstart
	,calculated periodEnd
;
quit;
	&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's the output:&lt;/P&gt;
&lt;P&gt;01/01/2017 12/25/2016 01/24/2017 125&lt;BR /&gt;08/01/2017 07/25/2017 08/24/2017 3151&lt;BR /&gt;09/01/2017 08/25/2017 09/24/2017 2015&lt;/P&gt;</description>
      <pubDate>Tue, 23 Oct 2018 15:41:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Getting-a-count-for-a-specific-date-range/m-p/506882#M135918</guid>
      <dc:creator>DBailey</dc:creator>
      <dc:date>2018-10-23T15:41:13Z</dc:date>
    </item>
    <item>
      <title>Re: Getting a count for a specific date range</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Getting-a-count-for-a-specific-date-range/m-p/506885#M135919</link>
      <description>What's stopping me is I dont know how to code that within my current program. I am able to get the count for all records within a given month, I just dont know how to get a count when I have data within two months, and need the output to reflect that it occurred in one month.&lt;BR /&gt;&lt;BR /&gt;Thank you for your input.</description>
      <pubDate>Tue, 23 Oct 2018 15:53:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Getting-a-count-for-a-specific-date-range/m-p/506885#M135919</guid>
      <dc:creator>aperansi</dc:creator>
      <dc:date>2018-10-23T15:53:07Z</dc:date>
    </item>
    <item>
      <title>Re: Getting a count for a specific date range</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Getting-a-count-for-a-specific-date-range/m-p/506906#M135927</link>
      <description>&lt;P&gt;So I altered this for my needs, and I am running into some issues. The new tablet isnt bringing in the mid, product, and vendor so I added that into the code.&amp;nbsp; The total API Counts for each individual product however seem to be off for the given period. Do you have a recommendation for this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is an image of the output from what you gave me.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2018-10-23 11_13_19-ictsassvr01 - Remote Desktop Connection.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/24327i1BCD9138DE7B86F0/image-size/large?v=v2&amp;amp;px=999" role="button" title="2018-10-23 11_13_19-ictsassvr01 - Remote Desktop Connection.png" alt="2018-10-23 11_13_19-ictsassvr01 - Remote Desktop Connection.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Oct 2018 16:18:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Getting-a-count-for-a-specific-date-range/m-p/506906#M135927</guid>
      <dc:creator>aperansi</dc:creator>
      <dc:date>2018-10-23T16:18:30Z</dc:date>
    </item>
    <item>
      <title>Re: Getting a count for a specific date range</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Getting-a-count-for-a-specific-date-range/m-p/506984#M135973</link>
      <description>&lt;P&gt;Use proc format like follow can solve your problem easily.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;format&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;value&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; NewMonth &lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;'05AUG2017'd&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt; - &lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;'05SEP2017'd&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;= &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;"August"&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;other = &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;"Other"&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;run&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; test;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;date=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;'01AUG2018'd&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;date2=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;'09AUG2017'd&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;month=put(date,&lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;newmonth.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;month2=put(date2,&lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;newmonth.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;run&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;print&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;; &lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;run&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Oct 2018 19:03:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Getting-a-count-for-a-specific-date-range/m-p/506984#M135973</guid>
      <dc:creator>NanLiu</dc:creator>
      <dc:date>2018-10-23T19:03:34Z</dc:date>
    </item>
    <item>
      <title>Re: Getting a count for a specific date range</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Getting-a-count-for-a-specific-date-range/m-p/507234#M136109</link>
      <description>&lt;P&gt;Did you add the mid/product/vendor to the group by statement?&lt;/P&gt;</description>
      <pubDate>Wed, 24 Oct 2018 16:49:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Getting-a-count-for-a-specific-date-range/m-p/507234#M136109</guid>
      <dc:creator>DBailey</dc:creator>
      <dc:date>2018-10-24T16:49:49Z</dc:date>
    </item>
    <item>
      <title>Re: Getting a count for a specific date range</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Getting-a-count-for-a-specific-date-range/m-p/507246#M136120</link>
      <description>No, I added it after the as Total_API_Count</description>
      <pubDate>Wed, 24 Oct 2018 17:21:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Getting-a-count-for-a-specific-date-range/m-p/507246#M136120</guid>
      <dc:creator>aperansi</dc:creator>
      <dc:date>2018-10-24T17:21:32Z</dc:date>
    </item>
    <item>
      <title>Re: Getting a count for a specific date range</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Getting-a-count-for-a-specific-date-range/m-p/507256#M136127</link>
      <description>&lt;P&gt;if you want the api count to be group by those values, then you'd need to include them in the group by statement.&amp;nbsp; If not, then I'm not seeing what's wrong.&lt;/P&gt;</description>
      <pubDate>Wed, 24 Oct 2018 17:54:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Getting-a-count-for-a-specific-date-range/m-p/507256#M136127</guid>
      <dc:creator>DBailey</dc:creator>
      <dc:date>2018-10-24T17:54:25Z</dc:date>
    </item>
    <item>
      <title>Re: Getting a count for a specific date range</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Getting-a-count-for-a-specific-date-range/m-p/507738#M136310</link>
      <description>Would you mind breifly explaining the logic around your original code so that I can have a better understanding of whats going on? I would greatly appreciate that. Thank you Mr. Bailey.</description>
      <pubDate>Fri, 26 Oct 2018 13:33:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Getting-a-count-for-a-specific-date-range/m-p/507738#M136310</guid>
      <dc:creator>aperansi</dc:creator>
      <dc:date>2018-10-26T13:33:49Z</dc:date>
    </item>
    <item>
      <title>Re: Getting a count for a specific date range</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Getting-a-count-for-a-specific-date-range/m-p/507749#M136313</link>
      <description>&lt;P&gt;&lt;SPAN class="token function"&gt;So INTNX('month',......) is used to move dates by a certain # of months.&amp;nbsp; It also can adjust to the beginning, ending, or the sameday in that new month.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;SPAN class="token function"&gt;intnx&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;'month'&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt;api_date&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt;case when day&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;api_date&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;&amp;gt;=&lt;/SPAN&gt;&lt;SPAN class="token number"&gt;25&lt;/SPAN&gt; &lt;SPAN class="token keyword"&gt;then&lt;/SPAN&gt; &lt;SPAN class="token number"&gt;1&lt;/SPAN&gt; &lt;SPAN class="token keyword"&gt;else&lt;/SPAN&gt; &lt;SPAN class="token number"&gt;0&lt;/SPAN&gt; end&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;'begin'&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt; &lt;SPAN class="token procnames"&gt;format&lt;/SPAN&gt; mmddyy10&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt; as Period&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="token function"&gt;I understood that if the api_date was between the 25th of the previous month and the 24th of the current month, that data was to be tagged as the first of the current month.&amp;nbsp; That can be translated to "if the api_date is 25 or greater, move to the next month otherwise keep the current month" which is used in the intnx function as the # of months to move and use the beginning of that resulting month.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="token function"&gt;&lt;STRONG&gt;&lt;SPAN class="token function"&gt;intnx&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;'month'&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt;api_date&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt;case when &lt;SPAN class="token function"&gt;day&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;api_date&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;&amp;gt;=&lt;/SPAN&gt;&lt;SPAN class="token number"&gt;25&lt;/SPAN&gt; &lt;SPAN class="token keyword"&gt;then&lt;/SPAN&gt; &lt;SPAN class="token number"&gt;0&lt;/SPAN&gt; &lt;SPAN class="token keyword"&gt;else&lt;/SPAN&gt; &lt;SPAN class="token operator"&gt;-&lt;/SPAN&gt; &lt;SPAN class="token number"&gt;1&lt;/SPAN&gt; end&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;'begin'&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;+&lt;/SPAN&gt;&lt;SPAN class="token number"&gt;24&lt;/SPAN&gt; &lt;SPAN class="token procnames"&gt;format&lt;/SPAN&gt; mmddyy10&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt; as PeriodStart&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="token function"&gt;If the api_date &amp;gt;= 25, move to the beginning of the current month and add 24 days (ends up on the 25th).&amp;nbsp; If the api_date &amp;lt; 25, move to the beginning of the prior month and add 24 days (resulting in the 25th of the prior month).&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="token function"&gt;&lt;BR /&gt; &lt;STRONG&gt;&lt;SPAN class="token function"&gt;intnx&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;'month'&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt;api_date&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt;case when &lt;SPAN class="token function"&gt;day&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;api_date&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;&amp;gt;=&lt;/SPAN&gt;&lt;SPAN class="token number"&gt;25&lt;/SPAN&gt; &lt;SPAN class="token keyword"&gt;then&lt;/SPAN&gt; &lt;SPAN class="token number"&gt;1&lt;/SPAN&gt; &lt;SPAN class="token keyword"&gt;else&lt;/SPAN&gt; &lt;SPAN class="token number"&gt;0&lt;/SPAN&gt; end&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;'begin'&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;+&lt;/SPAN&gt;&lt;SPAN class="token number"&gt;23&lt;/SPAN&gt; &lt;SPAN class="token procnames"&gt;format mmddyy10. as PeriodEnd&lt;/SPAN&gt;&lt;/STRONG&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="token function"&gt;if the api_date &amp;gt;= 25, move to the beginning of the next month and add 23 days (ends up on 24th of next month).&amp;nbsp; If the api_date &amp;lt; 25, move to the beginning of current month and add 23 days (ends up on 24th of current month).&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 26 Oct 2018 14:01:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Getting-a-count-for-a-specific-date-range/m-p/507749#M136313</guid>
      <dc:creator>DBailey</dc:creator>
      <dc:date>2018-10-26T14:01:17Z</dc:date>
    </item>
  </channel>
</rss>

