<?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 Start an increment count based on changes in data values - how? in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Start-an-increment-count-based-on-changes-in-data-values-how/m-p/14239#M2226</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier New;"&gt;&lt;SPAN style="color: #000080;"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/SPAN&gt; want ;&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier New;"&gt;&lt;SPAN style="color: #0000ff;"&gt;set&lt;/SPAN&gt; have ;&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier New;"&gt;&lt;SPAN style="color: #0000ff;"&gt;by&lt;/SPAN&gt; Date_of_Purchase ;&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier New;"&gt;Count + first.Date_of_Purchase ;&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier New; color: #000080;"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;SPAN style="color: #000000;"&gt; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 22 Sep 2011 01:20:29 GMT</pubDate>
    <dc:creator>Howles</dc:creator>
    <dc:date>2011-09-22T01:20:29Z</dc:date>
    <item>
      <title>Start an increment count based on changes in data values - how?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Start-an-increment-count-based-on-changes-in-data-values-how/m-p/14237#M2224</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Okay - I realize this is probably extremely easy to do in SAS but I for the life cannot figure it out - everything I've tried has not worked the way I need it to and am at my wits end.&amp;nbsp; Any help would be greatly appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let's say I have the following dataset in my work direcotry that consist of the first name of a customer and their date of purchase:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="1" cellpadding="3" cellspacing="0" class="jiveBorder" height="197" style="height: 197px; width: 220px; border-width: 1px; border-color: #000000; border-style: solid;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH align="center" style="background-color: #6690bc;" valign="middle"&gt;&lt;SPAN style="color: #ffffff;"&gt;First_Name&lt;/SPAN&gt;&lt;BR /&gt;&lt;/TH&gt;&lt;TH align="center" style="background-color: #6690bc;" valign="middle"&gt;&lt;SPAN style="color: #ffffff;"&gt;&lt;STRONG&gt;Date_of_Purchase&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;John&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;01/01/2010&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Jill&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;01/01/2010&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Beth&lt;/TD&gt;&lt;TD&gt;01/01/2010&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Will&lt;/TD&gt;&lt;TD&gt;02/01/2010&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Jen&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;02/01/2010&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Lori&lt;/TD&gt;&lt;TD&gt;03/01/2010&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Tom&lt;/TD&gt;&lt;TD&gt;03/01/2010&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Heidi&lt;/TD&gt;&lt;TD&gt;04/01/2010&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What I need to do is an incremental count based on the change in date_of_purchase starting with the value of 1, results of which is shown below.&amp;nbsp; I've tried various do-loop statements but cannot seem to populate the variable count with the value&amp;nbsp; when the date remains unchanged (for example, for 01/01/2010, I've no problem populating first.date_of_purchase with 1, but subsequent cells under Count tied to 01/01/2010 remain empty.&amp;nbsp; I've about 3 years worth of purchase data, with over thousand of customers.&amp;nbsp; Thanks!&amp;nbsp; If any clarification is needed, don't hestitate to let me know.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="1" cellpadding="3" cellspacing="0" class="jiveBorder" height="197" style="cursor: default; border-collapse: collapse; border: inherit; height: 197px; width: 220px; border-width: 1px; border-color: #000000; border-style: solid; margin: -1px;"&gt;&lt;TBODY style="border-style: solid;"&gt;&lt;TR style="border: inherit; border-color: inherit; border-width: inherit; border-style: solid;"&gt;&lt;TH align="center" style="border-collapse: collapse; cursor: text; border-color: inherit; border: inherit; background-color: #6690bc;" valign="middle"&gt;&lt;SPAN style="color: #ffffff;"&gt;First_Name&lt;/SPAN&gt;&lt;BR /&gt;&lt;/TH&gt;&lt;TH align="center" style="border-collapse: collapse; cursor: text; border-color: inherit; border: inherit; background-color: #6690bc;" valign="middle"&gt;&lt;SPAN style="color: #ffffff;"&gt;&lt;STRONG&gt;Date_of_Purchase&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TH&gt;&lt;TH align="center" style="border-collapse: collapse; cursor: text; border-color: inherit; border: inherit; background-color: #6690bc;" valign="middle"&gt;&lt;SPAN style="color: #ff0000;"&gt;Coun&lt;/SPAN&gt;t&lt;BR /&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;TR style="border: inherit; border-color: inherit; border-width: inherit; border-style: solid;"&gt;&lt;TD style="border-collapse: collapse; cursor: text; border-color: inherit; border: inherit;"&gt;John&lt;/TD&gt;&lt;TD style="border-collapse: collapse; cursor: text; border-color: inherit; border: inherit;"&gt;&lt;P&gt;01/01/2010&lt;/P&gt;&lt;/TD&gt;&lt;TD style="border-collapse: collapse; cursor: text; border-color: inherit; border: inherit;"&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="border: inherit; border-color: inherit; border-width: inherit; border-style: solid;"&gt;&lt;TD style="border-collapse: collapse; cursor: text; border-color: inherit; border: inherit;"&gt;Jill&lt;/TD&gt;&lt;TD style="border-collapse: collapse; cursor: text; border-color: inherit; border: inherit;"&gt;&lt;P&gt;01/01/2010&lt;/P&gt;&lt;/TD&gt;&lt;TD style="border-collapse: collapse; cursor: text; border-color: inherit; border: inherit;"&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="border: inherit; border-color: inherit; border-width: inherit; border-style: solid;"&gt;&lt;TD style="border-collapse: collapse; cursor: text; border-color: inherit; border: inherit;"&gt;Beth&lt;/TD&gt;&lt;TD style="border-collapse: collapse; cursor: text; border-color: inherit; border: inherit;"&gt;01/01/2010&lt;/TD&gt;&lt;TD style="border-collapse: collapse; cursor: text; border-color: inherit; border: inherit;"&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="border: inherit; border-color: inherit; border-width: inherit; border-style: solid;"&gt;&lt;TD style="border-collapse: collapse; cursor: text; border-color: inherit; border: inherit;"&gt;Will&lt;/TD&gt;&lt;TD style="border-collapse: collapse; cursor: text; border-color: inherit; border: inherit;"&gt;02/01/2010&lt;/TD&gt;&lt;TD style="border-collapse: collapse; cursor: text; border-color: inherit; border: inherit;"&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="border: inherit; border-color: inherit; border-width: inherit; border-style: solid;"&gt;&lt;TD style="border-collapse: collapse; cursor: text; border-color: inherit; border: inherit;"&gt;Jen&lt;/TD&gt;&lt;TD style="border-collapse: collapse; cursor: text; border-color: inherit; border: inherit;"&gt;&lt;P&gt;02/01/2010&lt;/P&gt;&lt;/TD&gt;&lt;TD style="border-collapse: collapse; cursor: text; border-color: inherit; border: inherit;"&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="border: inherit; border-color: inherit; border-width: inherit; border-style: solid;"&gt;&lt;TD style="border-collapse: collapse; cursor: text; border-color: inherit; border: inherit;"&gt;Lori&lt;/TD&gt;&lt;TD style="border-collapse: collapse; cursor: text; border-color: inherit; border: inherit;"&gt;03/01/2010&lt;/TD&gt;&lt;TD style="border-collapse: collapse; cursor: text; border-color: inherit; border: inherit;"&gt;3&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="border: inherit; border-color: inherit; border-width: inherit; border-style: solid;"&gt;&lt;TD style="border-collapse: collapse; cursor: text; border-color: inherit; border: inherit;"&gt;Tom&lt;/TD&gt;&lt;TD style="border-collapse: collapse; cursor: text; border-color: inherit; border: inherit;"&gt;03/01/2010&lt;/TD&gt;&lt;TD style="border-collapse: collapse; cursor: text; border-color: inherit; border: inherit;"&gt;3&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="border: inherit; border-color: inherit; border-width: inherit; border-style: solid;"&gt;&lt;TD style="border-collapse: collapse; cursor: text; border-color: inherit; border: inherit;"&gt;Heidi&lt;/TD&gt;&lt;TD style="border-collapse: collapse; cursor: text; border-color: inherit; border: inherit;"&gt;04/01/2010&lt;/TD&gt;&lt;TD style="border-collapse: collapse; cursor: text; border-color: inherit; border: inherit;"&gt;4&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Sep 2011 22:11:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Start-an-increment-count-based-on-changes-in-data-values-how/m-p/14237#M2224</guid>
      <dc:creator>justchecking</dc:creator>
      <dc:date>2011-09-21T22:11:32Z</dc:date>
    </item>
    <item>
      <title>Start an increment count based on changes in data values - how?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Start-an-increment-count-based-on-changes-in-data-values-how/m-p/14238#M2225</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Are you trying to increment based on number of purchases (which aren't shown in your sample data) or simply by number of months since 1JAN2010?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Sep 2011 22:27:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Start-an-increment-count-based-on-changes-in-data-values-how/m-p/14238#M2225</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2011-09-21T22:27:00Z</dc:date>
    </item>
    <item>
      <title>Start an increment count based on changes in data values - how?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Start-an-increment-count-based-on-changes-in-data-values-how/m-p/14239#M2226</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier New;"&gt;&lt;SPAN style="color: #000080;"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/SPAN&gt; want ;&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier New;"&gt;&lt;SPAN style="color: #0000ff;"&gt;set&lt;/SPAN&gt; have ;&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier New;"&gt;&lt;SPAN style="color: #0000ff;"&gt;by&lt;/SPAN&gt; Date_of_Purchase ;&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier New;"&gt;Count + first.Date_of_Purchase ;&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier New; color: #000080;"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;SPAN style="color: #000000;"&gt; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Sep 2011 01:20:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Start-an-increment-count-based-on-changes-in-data-values-how/m-p/14239#M2226</guid>
      <dc:creator>Howles</dc:creator>
      <dc:date>2011-09-22T01:20:29Z</dc:date>
    </item>
    <item>
      <title>Start an increment count based on changes in data values - how?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Start-an-increment-count-based-on-changes-in-data-values-how/m-p/14240#M2227</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If the order were the same with the order at your post.&lt;/P&gt;&lt;P&gt;That will be easy.&lt;/P&gt;&lt;P&gt;&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; if date_of _purchase ne lag(date_of_purchase) then count+1;&lt;/P&gt;&lt;P&gt;run;&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, 22 Sep 2011 05:27:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Start-an-increment-count-based-on-changes-in-data-values-how/m-p/14240#M2227</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2011-09-22T05:27:46Z</dc:date>
    </item>
  </channel>
</rss>

