title: SAS Do Over Macro - Backwards
body: <p>I am using the <a href="http://www2.sas.com/proceedings/sugi31/040-31.pdf" rel="nofollow">Macro Arrays and Do Over Macro</a>.</p>
  
  <p>I would like to rewrite this code with a do over macro:</p>
  
  <pre><code>if mysequence &gt; 4 then grammar_last_5 = grammar_last_4;
  if mysequence &gt; 3 then grammar_last_4 = grammar_last_3;
  if mysequence &gt; 2 then grammar_last_3 = grammar_last_2;
  if mysequence &gt; 1 then grammar_last_2 = grammar_last_1;
  </code></pre>
  
  <p>So my Do Over would look something like:</p>
  
  <pre><code>%do_over(values=2-5, phrase= if mysequence &gt; %eval(6-?) then grammar_last_%eval(7-?) = grammar_last_%eval(6-?);)
  </code></pre>
  
  <p>But that doesn't work.</p>
  
  <p>Does anyone know how this can be done?</p>
  
  <p>Thanks!!
  Adam</p>