<?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: Counting distinct customers from rolling 12 months? in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Counting-distinct-customers-from-rolling-12-months/m-p/47932#M12927</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Wow.. you all are lifesavers.&amp;nbsp; Thank you so much!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ever have that week where you've put in almost 50 hours by Wednesday getting a new project ready for presentation to S/EVP's... working with your manager to get it all correct... then your manager's boss tells you 2 days before presentation that it's not showing what he wants to see?&amp;nbsp; Yep, that was my day.&amp;nbsp; You all just saved me so much headache.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anyone live near Atlanta, GA?&amp;nbsp; I owe you a beer.&amp;nbsp; Dead serious.&amp;nbsp; (I could use one as well.)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 29 Mar 2012 04:50:45 GMT</pubDate>
    <dc:creator>RussellNonBrand</dc:creator>
    <dc:date>2012-03-29T04:50:45Z</dc:date>
    <item>
      <title>Counting distinct customers from rolling 12 months?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Counting-distinct-customers-from-rolling-12-months/m-p/47926#M12921</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey everyone,&lt;/P&gt;&lt;P&gt;I have been trying to search thet net, but to no avail.&amp;nbsp; I am putting together a new insights deck, and for part of it I need to count unique customers who have done a certain activity within the past 12 months, by month&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My final output will look something like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Month&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # of Customers (who have done this activity from 12 months back)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Jan-11&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 10 (i.e. 10 distinct customers have done this actvitiy at least once between 2/1/10 - 1/31/11)&lt;/P&gt;&lt;P&gt;Feb-11&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 12&lt;/P&gt;&lt;P&gt;Mar-11&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 15&lt;/P&gt;&lt;P&gt;Apr-11&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 14&lt;/P&gt;&lt;P&gt;May-11&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 18&lt;/P&gt;&lt;P&gt;etc...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So if someone had done the activity in, say, January 2010 and April 2010, he would show up in the LTM for January and for March, but drop off for April.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I can't just group by month and add, because then I will pick up duplicate customers.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please help!&amp;nbsp; Thank you so much!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Mar 2012 00:51:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Counting-distinct-customers-from-rolling-12-months/m-p/47926#M12921</guid>
      <dc:creator>RussellNonBrand</dc:creator>
      <dc:date>2012-03-29T00:51:57Z</dc:date>
    </item>
    <item>
      <title>Counting distinct customers from rolling 12 months?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Counting-distinct-customers-from-rolling-12-months/m-p/47927#M12922</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;can you post some sample data?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Mar 2012 01:01:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Counting-distinct-customers-from-rolling-12-months/m-p/47927#M12922</guid>
      <dc:creator>Linlin</dc:creator>
      <dc:date>2012-03-29T01:01:09Z</dc:date>
    </item>
    <item>
      <title>Re: Counting distinct customers from rolling 12 months?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Counting-distinct-customers-from-rolling-12-months/m-p/47928#M12923</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here is an example of YearMonth variable (YYYYMM) and a sample account number, then the chart on the right is what I want to populate.&amp;nbsp; Realistically I will be pulling about 35 million accounts, so it's a slightly difficult task &lt;SPAN __jive_emoticon_name="wink" __jive_macro_name="emoticon" class="jive_macro jive_emote"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks so much!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Mar 2012 01:39:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Counting-distinct-customers-from-rolling-12-months/m-p/47928#M12923</guid>
      <dc:creator>RussellNonBrand</dc:creator>
      <dc:date>2012-03-29T01:39:00Z</dc:date>
    </item>
    <item>
      <title>Re: Counting distinct customers from rolling 12 months?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Counting-distinct-customers-from-rolling-12-months/m-p/47929#M12924</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Assuming that dataset HAVE contains variables actDate : a SAS date ( i.e. actDate=mdy(mod(yearMonth, 100), 1, floor(yearMonth/100)) ) and Account_Number, this will do the count:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif; font-size: 12pt;"&gt;proc sql;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif; font-size: 12pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif; font-size: 12pt;"&gt;create table periods as&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif; font-size: 12pt;"&gt;select distinct &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif; font-size: 12pt;"&gt;intnx("month",actDate,0,"beginning") as period format=mmyyd7.,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif; font-size: 12pt;"&gt;intnx("month",actDate,-11,"beginning") as periodBeg format=yymmdd10., &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif; font-size: 12pt;"&gt;intnx("month",actDate,0,"end") as periodEnd format=yymmdd10. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif; font-size: 12pt;"&gt;from have;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif; font-size: 12pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif; font-size: 12pt;"&gt;create table want as&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif; font-size: 12pt;"&gt;select period, count(distinct Account_Number) as nbCust&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif; font-size: 12pt;"&gt;from periods inner join have on actDate between periodBeg and periodEnd&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif; font-size: 12pt;"&gt;group by period;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif; font-size: 12pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif; font-size: 12pt;"&gt;drop table periods;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif; font-size: 12pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif; font-size: 12pt;"&gt;select * from want;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif; font-size: 12pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif; font-size: 12pt;"&gt;quit;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Mar 2012 02:53:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Counting-distinct-customers-from-rolling-12-months/m-p/47929#M12924</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2012-03-29T02:53:59Z</dc:date>
    </item>
    <item>
      <title>Re: Counting distinct customers from rolling 12 months?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Counting-distinct-customers-from-rolling-12-months/m-p/47930#M12925</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi PG,&lt;/P&gt;&lt;P&gt;I ran your code using the data OP privided. I like your code very much!&amp;nbsp; Thank you! &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;input YearMonth $ Account_Number;&lt;/P&gt;&lt;P&gt;actDate=mdy(input(substr(yearmonth,5,2),2.),1,input(substr(yearmonth,1,4),4.));&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;201001&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;1&lt;/P&gt;&lt;P&gt;201001&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;2&lt;/P&gt;&lt;P&gt;201002&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;1&lt;/P&gt;&lt;P&gt;201002&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;3&lt;/P&gt;&lt;P&gt;201003&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;4&lt;/P&gt;&lt;P&gt;201003&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;5&lt;/P&gt;&lt;P&gt;201004&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;4&lt;/P&gt;&lt;P&gt;201004&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;5&lt;/P&gt;&lt;P&gt;201004&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;6&lt;/P&gt;&lt;P&gt;201005&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;1&lt;/P&gt;&lt;P&gt;201005&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;5&lt;/P&gt;&lt;P&gt;201006&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;1&lt;/P&gt;&lt;P&gt;201006&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;5&lt;/P&gt;&lt;P&gt;201006&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;7&lt;/P&gt;&lt;P&gt;201006&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;8&lt;/P&gt;&lt;P&gt;201006&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;9&lt;/P&gt;&lt;P&gt;201007&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;5&lt;/P&gt;&lt;P&gt;201007&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;7&lt;/P&gt;&lt;P&gt;201008&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;9&lt;/P&gt;&lt;P&gt;201009&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;4&lt;/P&gt;&lt;P&gt;201010&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;10&lt;/P&gt;&lt;P&gt;201010&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;11&lt;/P&gt;&lt;P&gt;201011&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;1&lt;/P&gt;&lt;P&gt;201011&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;12&lt;/P&gt;&lt;P&gt;201012&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;7&lt;/P&gt;&lt;P&gt;201101&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;1&lt;/P&gt;&lt;P&gt;201102&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;11&lt;/P&gt;&lt;P&gt;201103&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;12&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;create table periods as&lt;/P&gt;&lt;P&gt;select distinct&lt;/P&gt;&lt;P&gt;intnx("month",actDate,0,"beginning") as period format=mmyyd7.,&lt;/P&gt;&lt;P&gt;intnx("month",actDate,-11,"beginning") as periodBeg format=yymmdd10.,&lt;/P&gt;&lt;P&gt;intnx("month",actDate,0,"end") as periodEnd format=yymmdd10.&lt;/P&gt;&lt;P&gt;from have;&lt;/P&gt;&lt;P&gt;create table want as&lt;/P&gt;&lt;P&gt;select period, count(distinct Account_Number) as nbCust&lt;/P&gt;&lt;P&gt;from periods inner join have on actDate between periodBeg and periodEnd&lt;/P&gt;&lt;P&gt;group by period;&lt;/P&gt;&lt;P&gt;*drop table periods;&lt;/P&gt;&lt;P&gt;select * from want;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Mar 2012 03:54:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Counting-distinct-customers-from-rolling-12-months/m-p/47930#M12925</guid>
      <dc:creator>Linlin</dc:creator>
      <dc:date>2012-03-29T03:54:16Z</dc:date>
    </item>
    <item>
      <title>Re: Counting distinct customers from rolling 12 months?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Counting-distinct-customers-from-rolling-12-months/m-p/47931#M12926</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How about:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;data have;
 input month : yymmn. no;
 format month yymmn.;
 cards;
201001&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1
201001&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2
201002&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1
201002&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3
201003&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4
201003&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 5
201004&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4
201004&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 5
201004&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 6
201005&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1
201005&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 5
201006&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1
201006&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 5
201006&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 7
201006&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 8
201006&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 9
201007&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 5
201007&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 7
201008&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 9
201009&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4
201010&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 10
201010&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 11
201011&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1
201011&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 12
201012&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 7
201101&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1
201102&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 11
201103&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 12
;
run;



proc sql;
 select&amp;nbsp; distinct month ,(select count(distinct no)&amp;nbsp; from have where month between intnx('year',a.month,-1,'s')+1&amp;nbsp; and intnx('month',a.month,0,'e') ) as count
&amp;nbsp; from have as a ;
quit;


&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ksharp&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: xia keshan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Mar 2012 04:24:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Counting-distinct-customers-from-rolling-12-months/m-p/47931#M12926</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2012-03-29T04:24:28Z</dc:date>
    </item>
    <item>
      <title>Re: Counting distinct customers from rolling 12 months?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Counting-distinct-customers-from-rolling-12-months/m-p/47932#M12927</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Wow.. you all are lifesavers.&amp;nbsp; Thank you so much!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ever have that week where you've put in almost 50 hours by Wednesday getting a new project ready for presentation to S/EVP's... working with your manager to get it all correct... then your manager's boss tells you 2 days before presentation that it's not showing what he wants to see?&amp;nbsp; Yep, that was my day.&amp;nbsp; You all just saved me so much headache.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anyone live near Atlanta, GA?&amp;nbsp; I owe you a beer.&amp;nbsp; Dead serious.&amp;nbsp; (I could use one as well.)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Mar 2012 04:50:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Counting-distinct-customers-from-rolling-12-months/m-p/47932#M12927</guid>
      <dc:creator>RussellNonBrand</dc:creator>
      <dc:date>2012-03-29T04:50:45Z</dc:date>
    </item>
    <item>
      <title>Re: Counting distinct customers from rolling 12 months?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Counting-distinct-customers-from-rolling-12-months/m-p/47933#M12928</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Unfortunately. I am in BeiJing ,China.&lt;/P&gt;&lt;P&gt;&lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ksharp&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Mar 2012 07:27:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Counting-distinct-customers-from-rolling-12-months/m-p/47933#M12928</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2012-03-29T07:27:56Z</dc:date>
    </item>
    <item>
      <title>Re: Counting distinct customers from rolling 12 months?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Counting-distinct-customers-from-rolling-12-months/m-p/47934#M12929</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How about some virtual beer?:smileylaugh:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;www.virtualbeer.com/&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Mar 2012 14:01:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Counting-distinct-customers-from-rolling-12-months/m-p/47934#M12929</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2012-03-29T14:01:16Z</dc:date>
    </item>
  </channel>
</rss>

