title: The sum of the multiplied variables
body: <p>I need translate to SAS below "filter" from R cran:</p>
  
  <pre><code>filter(1:5, f1, method="recursive")
  [1]  1  3  6 10 15
  </code></pre>
  
  <h1>equivalent to:</h1>
  
  <pre><code>x[1]
  x[2] + f1*x[1]
  x[3] + f1*x[2] + f1^2*x[1]
  x[4] + f1*x[3] + f1^2*x[2] + f1^3*x[1]
  x[5] + f1*x[4] + f1^2*x[3] + f1^3*x[2] + f1^4*x[1]
  </code></pre>
  
  <p>f1 is integer. I think I should use look. Do you have any idea on solution?</p>
  
  <p>For example:</p>
  
  <p><a href="https://i.stack.imgur.com/AF5RI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/AF5RI.png" alt="enter image description here"></a></p>
  
  <p>My code in the SAS:</p>
  
  <pre><code>data have;
    input Variable Value;
  datalines;
  a 1
  a 4
  a 5
  b 6
  b 7
  b 10
  
  ;
  run;
  
  
  data want;
  set have;
  by Variable;
  %let f1=0.5;
   set have (firstobs=2 keep=Value rename=(Value=LEAD1));
   if last.Variable then LEAD1=.;
    if first.Variable then do;
  Out=Value*&amp;f1;
  end;
  Out=LEAD1*&amp;f1+Value*&amp;f1;
  run;
  </code></pre>
  
  <p>This code is working!!!:D</p>