<?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: running day count that starts over after 30 days? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/running-day-count-that-starts-over-after-30-days/m-p/156369#M30553</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;set have;&lt;/P&gt;&lt;P&gt;BY customer category;&lt;/P&gt;&lt;P&gt;retain first_day;&lt;/P&gt;&lt;P&gt;if first.category then do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; first_day=purchase;&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if purchase-first_day+1&amp;gt;30 then first_day=purchase;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;running_count1=purchase-first_day+1;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 29 Jan 2014 22:55:05 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2014-01-29T22:55:05Z</dc:date>
    <item>
      <title>running day count that starts over after 30 days?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/running-day-count-that-starts-over-after-30-days/m-p/156364#M30548</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;Hi all&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am working on updating our contact management system.&amp;nbsp; I wrote a program that does what I am about to ask, but it has a ton of steps and is getting hard to maintain.&amp;nbsp; I was hoping someone in SAS Land had something that does something similar (a macro?) to this that I could work off of.&amp;nbsp; Any help is GREATLY appreciated!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I basically need a count of days from a customer's first order within a category, that then starts over after 30 days.&amp;nbsp; Example... Customer A buys a shirt on Jan 3 (day_count=1), Jan 7 (day_count=5), Feb 1 (day_count=30), and Feb 16 (would be day_count=45, but I want it to start over at day_count=1 since it's after day 30), and so on&amp;nbsp; The count is easy with first., but how do I get it start over when day_count&amp;gt;30?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;An additional augmentation to the process would be to get a day count for that customer between category purchases&amp;nbsp; (he buys a shirt on Jan 1 (cat_day_count=1) and buys pants on Feb 16 cat_day_count=45)) that starts over after 90 days... but if I can get the first part working, I can work this out.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks again!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Jan 2014 21:38:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/running-day-count-that-starts-over-after-30-days/m-p/156364#M30548</guid>
      <dc:creator>stuart_snap</dc:creator>
      <dc:date>2014-01-29T21:38:22Z</dc:date>
    </item>
    <item>
      <title>Re: running day count that starts over after 30 days?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/running-day-count-that-starts-over-after-30-days/m-p/156365#M30549</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;By attaching some sample input and desired output data I bet you'll get us going...!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Jan 2014 22:03:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/running-day-count-that-starts-over-after-30-days/m-p/156365#M30549</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2014-01-29T22:03:21Z</dc:date>
    </item>
    <item>
      <title>Re: running day count that starts over after 30 days?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/running-day-count-that-starts-over-after-30-days/m-p/156366#M30550</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Working up some fake stuff now;)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Jan 2014 22:05:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/running-day-count-that-starts-over-after-30-days/m-p/156366#M30550</guid>
      <dc:creator>stuart_snap</dc:creator>
      <dc:date>2014-01-29T22:05:03Z</dc:date>
    </item>
    <item>
      <title>Re: running day count that starts over after 30 days?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/running-day-count-that-starts-over-after-30-days/m-p/156367#M30551</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;Attached is some generic data. The inputs are in yellow, the desired output vars are in green, and there are some notes in blue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks a billion for any help!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Jan 2014 22:33:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/running-day-count-that-starts-over-after-30-days/m-p/156367#M30551</guid>
      <dc:creator>stuart_snap</dc:creator>
      <dc:date>2014-01-29T22:33:10Z</dc:date>
    </item>
    <item>
      <title>Re: running day count that starts over after 30 days?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/running-day-count-that-starts-over-after-30-days/m-p/156368#M30552</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can you post some sample data for what you're looking for?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I can't get the picture here.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For doing date calcs look into intnx/intck functions, which can also take custom intervals.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Jan 2014 22:46:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/running-day-count-that-starts-over-after-30-days/m-p/156368#M30552</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2014-01-29T22:46:07Z</dc:date>
    </item>
    <item>
      <title>Re: running day count that starts over after 30 days?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/running-day-count-that-starts-over-after-30-days/m-p/156369#M30553</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;set have;&lt;/P&gt;&lt;P&gt;BY customer category;&lt;/P&gt;&lt;P&gt;retain first_day;&lt;/P&gt;&lt;P&gt;if first.category then do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; first_day=purchase;&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if purchase-first_day+1&amp;gt;30 then first_day=purchase;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;running_count1=purchase-first_day+1;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Jan 2014 22:55:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/running-day-count-that-starts-over-after-30-days/m-p/156369#M30553</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2014-01-29T22:55:05Z</dc:date>
    </item>
    <item>
      <title>Re: running day count that starts over after 30 days?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/running-day-count-that-starts-over-after-30-days/m-p/156370#M30554</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;Thank you!!!!!!!!!! That answered 100% of what I asked.&amp;nbsp; However, after thinking about it, only answered about 80% of what I need:)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hopefully, I can get some more help!&amp;nbsp; Let me state the ultimate goal... When a customer orders, I want to mail them a survey about the product.&amp;nbsp; I don't want to mail that customer again about that product for 90 days, or about any product for 30 days.&amp;nbsp; So, after they are surveyed once, they are completely suppressed for all surveys for 30 days, and suppressed for surveys on that product for 90 days.&amp;nbsp; For each customer, I want to use historical data to show when each client would have been mailed.&amp;nbsp; I have reworked the sample data to show what I have and I need.&amp;nbsp; T&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks again!&amp;nbsp; I feel like an idiot, but for some reason I can't lock this logic in!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Jan 2014 16:02:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/running-day-count-that-starts-over-after-30-days/m-p/156370#M30554</guid>
      <dc:creator>stuart_snap</dc:creator>
      <dc:date>2014-01-30T16:02:03Z</dc:date>
    </item>
    <item>
      <title>Re: running day count that starts over after 30 days?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/running-day-count-that-starts-over-after-30-days/m-p/156371#M30555</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It sounds like you only want records where the count is 1. Try adding the line below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;set have;&lt;/P&gt;&lt;P&gt;BY customer category;&lt;/P&gt;&lt;P&gt;retain first_day;&lt;/P&gt;&lt;P&gt;if first.category then do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; first_day=purchase;&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if purchase-first_day+1&amp;gt;30 then first_day=purchase;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;running_count1=purchase-first_day+1;&lt;/P&gt;&lt;P&gt;if running_count1=1 then output;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Jan 2014 16:05:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/running-day-count-that-starts-over-after-30-days/m-p/156371#M30555</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2014-01-30T16:05:20Z</dc:date>
    </item>
    <item>
      <title>Re: running day count that starts over after 30 days?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/running-day-count-that-starts-over-after-30-days/m-p/156372#M30556</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;one step ahead of you on that one!&amp;nbsp; &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;&amp;nbsp; That gives me all the eligible mail days using the 30 day rule.&amp;nbsp; I now have to take the 90 day rule into account.&amp;nbsp; I tried using the same logic for 90 days and then just merging the 2 eligible universes.&amp;nbsp; But, that gets some false positives. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'll keep chugging along.&amp;nbsp; Thanks again for your help!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Jan 2014 16:16:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/running-day-count-that-starts-over-after-30-days/m-p/156372#M30556</guid>
      <dc:creator>stuart_snap</dc:creator>
      <dc:date>2014-01-30T16:16:43Z</dc:date>
    </item>
    <item>
      <title>Re: running day count that starts over after 30 days?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/running-day-count-that-starts-over-after-30-days/m-p/156373#M30557</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How many products are you likely to have? Is it fixed or dynamic?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Jan 2014 16:44:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/running-day-count-that-starts-over-after-30-days/m-p/156373#M30557</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2014-01-30T16:44:48Z</dc:date>
    </item>
    <item>
      <title>Re: running day count that starts over after 30 days?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/running-day-count-that-starts-over-after-30-days/m-p/156374#M30558</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;14.&amp;nbsp; That could change, but static for now.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Jan 2014 16:49:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/running-day-count-that-starts-over-after-30-days/m-p/156374#M30558</guid>
      <dc:creator>stuart_snap</dc:creator>
      <dc:date>2014-01-30T16:49:51Z</dc:date>
    </item>
    <item>
      <title>Re: running day count that starts over after 30 days?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/running-day-count-that-starts-over-after-30-days/m-p/156375#M30559</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You may want to mark this question and answered and re-post your new question. &lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I think the fundamentals behind the new question is actually different and this solution won't work for it as well. You'll get more responses this way.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Jan 2014 18:37:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/running-day-count-that-starts-over-after-30-days/m-p/156375#M30559</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2014-01-30T18:37:34Z</dc:date>
    </item>
  </channel>
</rss>

