title: Sum of the values of the previous dates in SAS
body: <p>I want to take the sum of the values of previous dates except current date by Product. Given below is the dataset. In the output table, I have mentioned how my summation of values of previous dates should look like.</p>
  
  <p>For Eg: For the date 7/27/2014 I want the summation of the previous dates except current date by product level. Similarly when you are taking the summation for 7/20/2014 ignore the values for 7/20/2014 and also 7/27/2014 and take rest of the previous dates.
  Also there is a exception here. When you see duplicates for example 7/20/2014 and 6/8/2014 consider just one value.</p>
  
  <pre><code>DATE    DEALID      PRODUCT      VALUE
  7/27/2014   6575    CLIENT      4
  7/20/2014   16701   CLIENT      6
  7/20/2014   16701   CLIENT      6
  7/13/2014   6601    CLIENT      4
  7/6/2014    10871   SERVICES    5
  6/29/2014   16661   SERVICES    2
  6/22/2014   66757   SERVICES    1
  6/15/2014   77757   SERVICES    5
  6/8/2014    5675    SERVICES    8
  6/8/2014    5675    SERVICES    8
  5/25/2014   5756    SERVICES    4
  </code></pre>
  
  <p>output table</p>
  
  <pre><code>DATE    DEALID  PRODUCT       VALUE SUMM
  7/27/2014   6575    CLIENT      4   10
  7/20/2014   16701   CLIENT      6   4
  7/20/2014   16701   CLIENT      6   4
  7/13/2014   6601    CLIENT      4   0
  7/6/2014    10871   SERVICES    5   20
  6/29/2014   16661   SERVICES    2   18
  6/22/2014   66757   SERVICES    1   17
  6/15/2014   77757   SERVICES    5   12
  6/8/2014    5675    SERVICES    8   4
  6/8/2014    5675    SERVICES    8   4
  5/25/2014   5756    SERVICES    4   0
  </code></pre>