<?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 Counter field issue in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Counter-field-issue/m-p/705727#M216543</link>
    <description>&lt;P style="margin: 0in; margin-bottom: .0001pt; line-height: 15.75pt; background: white;"&gt;&lt;SPAN style="font-size: 10.5pt; font-family: 'Arial',sans-serif; color: #333333;"&gt;I have created a counter field in the past but now I want to create a counter field based on a condition within other variables in the data set.&amp;nbsp; Here is my code:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in; margin-bottom: .0001pt; line-height: 15.75pt; background: white; box-sizing: border-box; font-variant-ligatures: normal; font-variant-caps: normal; orphans: 2; widows: 2; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; word-spacing: 0px;"&gt;&lt;SPAN style="font-size: 10.5pt; font-family: 'Arial',sans-serif; color: #333333;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in; margin-bottom: .0001pt; line-height: 15.75pt; background: white; box-sizing: border-box; font-variant-ligatures: normal; font-variant-caps: normal; orphans: 2; widows: 2; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; word-spacing: 0px;"&gt;&lt;SPAN style="font-size: 10.5pt; font-family: 'Arial',sans-serif; color: #333333;"&gt;data test_acct_2;&lt;BR style="box-sizing: border-box;" /&gt;set test_acct_1;&lt;BR style="box-sizing: border-box;" /&gt;by Proc_Date;&lt;BR style="box-sizing: border-box;" /&gt;if Close_Date lt Proc_Date&lt;BR style="box-sizing: border-box;" /&gt;then DIR = 1;&lt;BR style="box-sizing: border-box;" /&gt;else DIR + 1; /*iterative statement*/&lt;BR style="box-sizing: border-box;" /&gt;run;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in; margin-bottom: .0001pt; line-height: 15.75pt; background: white; box-sizing: border-box; font-variant-ligatures: normal; font-variant-caps: normal; orphans: 2; widows: 2; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; word-spacing: 0px;"&gt;&lt;SPAN style="font-size: 10.5pt; font-family: 'Arial',sans-serif; color: #333333;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in; margin-bottom: .0001pt; line-height: 15.75pt; background: white; box-sizing: border-box; font-variant-ligatures: normal; font-variant-caps: normal; orphans: 2; widows: 2; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; word-spacing: 0px;"&gt;&lt;SPAN style="font-size: 10.5pt; font-family: 'Arial',sans-serif; color: #333333;"&gt;In my dataset there are records for a particular field (Close_Date) that were created before the start of this particular process.&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in; margin-bottom: .0001pt; line-height: 15.75pt; background: white; box-sizing: border-box; font-variant-ligatures: normal; font-variant-caps: normal; orphans: 2; widows: 2; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; word-spacing: 0px;"&gt;&lt;SPAN style="font-size: 10.5pt; font-family: 'Arial',sans-serif; color: #333333;"&gt;As a result, I have to recalculate the number of days for the DIS (DaysInStorage) field.&amp;nbsp; Let me show the data set:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in; margin-bottom: .0001pt; line-height: 15.75pt; background: white; box-sizing: border-box; font-variant-ligatures: normal; font-variant-caps: normal; orphans: 2; widows: 2; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; word-spacing: 0px;"&gt;&lt;SPAN style="font-size: 10.5pt; font-family: 'Arial',sans-serif; color: #333333;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in; margin-bottom: .0001pt; line-height: 15.75pt; background: white; box-sizing: border-box; font-variant-ligatures: normal; font-variant-caps: normal; orphans: 2; widows: 2; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; word-spacing: 0px;"&gt;&lt;SPAN style="font-size: 10.5pt; font-family: 'Arial',sans-serif; color: #333333;"&gt;AccountNumber&amp;nbsp; Proc_Date&amp;nbsp; &amp;nbsp;Close_Date&amp;nbsp; Close_Amt&amp;nbsp; &amp;nbsp;Balance&amp;nbsp; DaysInStorage&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in; margin-bottom: .0001pt; line-height: 15.75pt; background: white; box-sizing: border-box; font-variant-ligatures: normal; font-variant-caps: normal; orphans: 2; widows: 2; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; word-spacing: 0px;"&gt;&lt;SPAN style="font-size: 10.5pt; font-family: 'Arial',sans-serif; color: #333333;"&gt;1001&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;6/10/19&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;5/24/18&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $500&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $500&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 512&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in; margin-bottom: .0001pt; line-height: 15.75pt; background: white; box-sizing: border-box; font-variant-ligatures: normal; font-variant-caps: normal; orphans: 2; widows: 2; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; word-spacing: 0px;"&gt;&lt;SPAN style="font-size: 10.5pt; font-family: 'Arial',sans-serif; color: #333333;"&gt;1001&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;6/11/19&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;5/24/18&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $500&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $500&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 513&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in; margin-bottom: .0001pt; line-height: 15.75pt; background: white; box-sizing: border-box; font-variant-ligatures: normal; font-variant-caps: normal; orphans: 2; widows: 2; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; word-spacing: 0px;"&gt;&lt;SPAN style="font-size: 10.5pt; font-family: 'Arial',sans-serif; color: #333333;"&gt;1001&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;6/12/19&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;5/24/18&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $500&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $500&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 514&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in; margin-bottom: .0001pt; line-height: 15.75pt; background: white; box-sizing: border-box; font-variant-ligatures: normal; font-variant-caps: normal; orphans: 2; widows: 2; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; word-spacing: 0px;"&gt;&lt;SPAN style="font-size: 10.5pt; font-family: 'Arial',sans-serif; color: #333333;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in; margin-bottom: .0001pt; line-height: 15.75pt; background: white; box-sizing: border-box; font-variant-ligatures: normal; font-variant-caps: normal; orphans: 2; widows: 2; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; word-spacing: 0px;"&gt;&lt;SPAN style="font-size: 10.5pt; font-family: 'Arial',sans-serif; color: #333333;"&gt;I want to create this new counter field labeled DIS based on the difference between the close date and processing date.&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in; margin-bottom: .0001pt; line-height: 15.75pt; background: white; box-sizing: border-box; font-variant-ligatures: normal; font-variant-caps: normal; orphans: 2; widows: 2; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; word-spacing: 0px;"&gt;&lt;SPAN style="font-size: 10.5pt; font-family: 'Arial',sans-serif; color: #333333;"&gt;In the event the close date came before the processing date for a particular account, I want the counter to start at 1, else&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in; margin-bottom: .0001pt; line-height: 15.75pt; background: white; box-sizing: border-box; font-variant-ligatures: normal; font-variant-caps: normal; orphans: 2; widows: 2; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; word-spacing: 0px;"&gt;&lt;SPAN style="font-size: 10.5pt; font-family: 'Arial',sans-serif; color: #333333;"&gt;revert to the value of the DaysInStorage field.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in; margin-bottom: .0001pt; line-height: 15.75pt; background: white; box-sizing: border-box; font-variant-ligatures: normal; font-variant-caps: normal; orphans: 2; widows: 2; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; word-spacing: 0px;"&gt;&lt;SPAN style="font-size: 10.5pt; font-family: 'Arial',sans-serif; color: #333333;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in; margin-bottom: .0001pt; line-height: 15.75pt; background: white; box-sizing: border-box; font-variant-ligatures: normal; font-variant-caps: normal; orphans: 2; widows: 2; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; word-spacing: 0px;"&gt;&lt;SPAN style="font-size: 10.5pt; font-family: 'Arial',sans-serif; color: #333333;"&gt;Unfortunately, my code produces a 1 for every iteration.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in; margin-bottom: .0001pt; line-height: 15.75pt; background: white; box-sizing: border-box; font-variant-ligatures: normal; font-variant-caps: normal; orphans: 2; widows: 2; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; word-spacing: 0px;"&gt;&lt;SPAN style="font-size: 10.5pt; font-family: 'Arial',sans-serif; color: #333333;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in; margin-bottom: .0001pt; line-height: 15.75pt; background: white; box-sizing: border-box; font-variant-ligatures: normal; font-variant-caps: normal; orphans: 2; widows: 2; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; word-spacing: 0px;"&gt;&lt;SPAN style="font-size: 10.5pt; font-family: 'Arial',sans-serif; color: #333333;"&gt;Any assistance would be greatly appreciated.&amp;nbsp; Thanks.&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 14 Dec 2020 15:13:32 GMT</pubDate>
    <dc:creator>greg6363</dc:creator>
    <dc:date>2020-12-14T15:13:32Z</dc:date>
    <item>
      <title>Counter field issue</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Counter-field-issue/m-p/705727#M216543</link>
      <description>&lt;P style="margin: 0in; margin-bottom: .0001pt; line-height: 15.75pt; background: white;"&gt;&lt;SPAN style="font-size: 10.5pt; font-family: 'Arial',sans-serif; color: #333333;"&gt;I have created a counter field in the past but now I want to create a counter field based on a condition within other variables in the data set.&amp;nbsp; Here is my code:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in; margin-bottom: .0001pt; line-height: 15.75pt; background: white; box-sizing: border-box; font-variant-ligatures: normal; font-variant-caps: normal; orphans: 2; widows: 2; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; word-spacing: 0px;"&gt;&lt;SPAN style="font-size: 10.5pt; font-family: 'Arial',sans-serif; color: #333333;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in; margin-bottom: .0001pt; line-height: 15.75pt; background: white; box-sizing: border-box; font-variant-ligatures: normal; font-variant-caps: normal; orphans: 2; widows: 2; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; word-spacing: 0px;"&gt;&lt;SPAN style="font-size: 10.5pt; font-family: 'Arial',sans-serif; color: #333333;"&gt;data test_acct_2;&lt;BR style="box-sizing: border-box;" /&gt;set test_acct_1;&lt;BR style="box-sizing: border-box;" /&gt;by Proc_Date;&lt;BR style="box-sizing: border-box;" /&gt;if Close_Date lt Proc_Date&lt;BR style="box-sizing: border-box;" /&gt;then DIR = 1;&lt;BR style="box-sizing: border-box;" /&gt;else DIR + 1; /*iterative statement*/&lt;BR style="box-sizing: border-box;" /&gt;run;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in; margin-bottom: .0001pt; line-height: 15.75pt; background: white; box-sizing: border-box; font-variant-ligatures: normal; font-variant-caps: normal; orphans: 2; widows: 2; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; word-spacing: 0px;"&gt;&lt;SPAN style="font-size: 10.5pt; font-family: 'Arial',sans-serif; color: #333333;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in; margin-bottom: .0001pt; line-height: 15.75pt; background: white; box-sizing: border-box; font-variant-ligatures: normal; font-variant-caps: normal; orphans: 2; widows: 2; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; word-spacing: 0px;"&gt;&lt;SPAN style="font-size: 10.5pt; font-family: 'Arial',sans-serif; color: #333333;"&gt;In my dataset there are records for a particular field (Close_Date) that were created before the start of this particular process.&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in; margin-bottom: .0001pt; line-height: 15.75pt; background: white; box-sizing: border-box; font-variant-ligatures: normal; font-variant-caps: normal; orphans: 2; widows: 2; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; word-spacing: 0px;"&gt;&lt;SPAN style="font-size: 10.5pt; font-family: 'Arial',sans-serif; color: #333333;"&gt;As a result, I have to recalculate the number of days for the DIS (DaysInStorage) field.&amp;nbsp; Let me show the data set:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in; margin-bottom: .0001pt; line-height: 15.75pt; background: white; box-sizing: border-box; font-variant-ligatures: normal; font-variant-caps: normal; orphans: 2; widows: 2; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; word-spacing: 0px;"&gt;&lt;SPAN style="font-size: 10.5pt; font-family: 'Arial',sans-serif; color: #333333;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in; margin-bottom: .0001pt; line-height: 15.75pt; background: white; box-sizing: border-box; font-variant-ligatures: normal; font-variant-caps: normal; orphans: 2; widows: 2; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; word-spacing: 0px;"&gt;&lt;SPAN style="font-size: 10.5pt; font-family: 'Arial',sans-serif; color: #333333;"&gt;AccountNumber&amp;nbsp; Proc_Date&amp;nbsp; &amp;nbsp;Close_Date&amp;nbsp; Close_Amt&amp;nbsp; &amp;nbsp;Balance&amp;nbsp; DaysInStorage&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in; margin-bottom: .0001pt; line-height: 15.75pt; background: white; box-sizing: border-box; font-variant-ligatures: normal; font-variant-caps: normal; orphans: 2; widows: 2; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; word-spacing: 0px;"&gt;&lt;SPAN style="font-size: 10.5pt; font-family: 'Arial',sans-serif; color: #333333;"&gt;1001&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;6/10/19&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;5/24/18&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $500&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $500&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 512&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in; margin-bottom: .0001pt; line-height: 15.75pt; background: white; box-sizing: border-box; font-variant-ligatures: normal; font-variant-caps: normal; orphans: 2; widows: 2; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; word-spacing: 0px;"&gt;&lt;SPAN style="font-size: 10.5pt; font-family: 'Arial',sans-serif; color: #333333;"&gt;1001&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;6/11/19&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;5/24/18&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $500&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $500&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 513&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in; margin-bottom: .0001pt; line-height: 15.75pt; background: white; box-sizing: border-box; font-variant-ligatures: normal; font-variant-caps: normal; orphans: 2; widows: 2; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; word-spacing: 0px;"&gt;&lt;SPAN style="font-size: 10.5pt; font-family: 'Arial',sans-serif; color: #333333;"&gt;1001&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;6/12/19&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;5/24/18&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $500&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $500&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 514&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in; margin-bottom: .0001pt; line-height: 15.75pt; background: white; box-sizing: border-box; font-variant-ligatures: normal; font-variant-caps: normal; orphans: 2; widows: 2; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; word-spacing: 0px;"&gt;&lt;SPAN style="font-size: 10.5pt; font-family: 'Arial',sans-serif; color: #333333;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in; margin-bottom: .0001pt; line-height: 15.75pt; background: white; box-sizing: border-box; font-variant-ligatures: normal; font-variant-caps: normal; orphans: 2; widows: 2; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; word-spacing: 0px;"&gt;&lt;SPAN style="font-size: 10.5pt; font-family: 'Arial',sans-serif; color: #333333;"&gt;I want to create this new counter field labeled DIS based on the difference between the close date and processing date.&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in; margin-bottom: .0001pt; line-height: 15.75pt; background: white; box-sizing: border-box; font-variant-ligatures: normal; font-variant-caps: normal; orphans: 2; widows: 2; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; word-spacing: 0px;"&gt;&lt;SPAN style="font-size: 10.5pt; font-family: 'Arial',sans-serif; color: #333333;"&gt;In the event the close date came before the processing date for a particular account, I want the counter to start at 1, else&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in; margin-bottom: .0001pt; line-height: 15.75pt; background: white; box-sizing: border-box; font-variant-ligatures: normal; font-variant-caps: normal; orphans: 2; widows: 2; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; word-spacing: 0px;"&gt;&lt;SPAN style="font-size: 10.5pt; font-family: 'Arial',sans-serif; color: #333333;"&gt;revert to the value of the DaysInStorage field.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in; margin-bottom: .0001pt; line-height: 15.75pt; background: white; box-sizing: border-box; font-variant-ligatures: normal; font-variant-caps: normal; orphans: 2; widows: 2; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; word-spacing: 0px;"&gt;&lt;SPAN style="font-size: 10.5pt; font-family: 'Arial',sans-serif; color: #333333;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in; margin-bottom: .0001pt; line-height: 15.75pt; background: white; box-sizing: border-box; font-variant-ligatures: normal; font-variant-caps: normal; orphans: 2; widows: 2; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; word-spacing: 0px;"&gt;&lt;SPAN style="font-size: 10.5pt; font-family: 'Arial',sans-serif; color: #333333;"&gt;Unfortunately, my code produces a 1 for every iteration.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in; margin-bottom: .0001pt; line-height: 15.75pt; background: white; box-sizing: border-box; font-variant-ligatures: normal; font-variant-caps: normal; orphans: 2; widows: 2; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; word-spacing: 0px;"&gt;&lt;SPAN style="font-size: 10.5pt; font-family: 'Arial',sans-serif; color: #333333;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in; margin-bottom: .0001pt; line-height: 15.75pt; background: white; box-sizing: border-box; font-variant-ligatures: normal; font-variant-caps: normal; orphans: 2; widows: 2; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; word-spacing: 0px;"&gt;&lt;SPAN style="font-size: 10.5pt; font-family: 'Arial',sans-serif; color: #333333;"&gt;Any assistance would be greatly appreciated.&amp;nbsp; Thanks.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Dec 2020 15:13:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Counter-field-issue/m-p/705727#M216543</guid>
      <dc:creator>greg6363</dc:creator>
      <dc:date>2020-12-14T15:13:32Z</dc:date>
    </item>
    <item>
      <title>Re: Counter field issue</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Counter-field-issue/m-p/705852#M216582</link>
      <description>&lt;P&gt;&lt;EM&gt;&amp;gt;&amp;nbsp;Unfortunately, my code produces a 1 for every iteration.&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;You mean for every observation?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&amp;gt; In the event the close date came before the processing date for a particular account, I want the counter to start at 1&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;That's the case for every observation, so it makes sense that you always&amp;nbsp;obtain 1.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Dec 2020 22:00:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Counter-field-issue/m-p/705852#M216582</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2020-12-14T22:00:15Z</dc:date>
    </item>
    <item>
      <title>Re: Counter field issue</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Counter-field-issue/m-p/705879#M216592</link>
      <description>&lt;P&gt;Suggestion:&lt;/P&gt;
&lt;P&gt;Show an example of the data where you have a close date &amp;gt; proc date within an account number and what you expect the result to look like.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you have more than one account in your data then I suspect your result is very wrong because you should should be using BY AccountNumber Proc_date; (and the by proc date from the data you show is likely not needed as I don't see any processing using the By properties of Proc_date.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;See if this gives you a start assuming your data is sorted by AccountNumber.&lt;/P&gt;
&lt;PRE&gt;data test_acct_2;
   set test_acct_1;
   by AccountNumber;
  if first.AccountNumber then
  then DIR = 0;
  if close_date lt Proc_date then Dir+1;
  /* you don't say what really should happen 
     when close_date ge Proc date in a way 
     I understand
  */
run;&lt;/PRE&gt;</description>
      <pubDate>Mon, 14 Dec 2020 23:59:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Counter-field-issue/m-p/705879#M216592</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-12-14T23:59:58Z</dc:date>
    </item>
  </channel>
</rss>

