title: SAS Loop over a list of variables inside a macro (read one each time)
body: <p>I would need to do a loop over a list of variables inside a macro.</p>
  
  <p>The list is created in the following way (I have started the name of the variables that I want with MO, nu or KA):</p>
  
  <pre><code>proc sql noprint; 
     select name into :varsi separated by ' ' 
     from dictionary.columns 
     where libname eq 'LABIMP' and  memname eq 'MUESTRA1' 
       and (NAME LIKE 'MO_%' OR NAME LIKE 'nu_%' or name like 'KA_%'); 
  quit;
  </code></pre>
  
  <p>Then, I need to run a macro for each one... this macro is inside the following data step:</p>
  
  <pre><code>data labimp.muestra1;
     set labimp.muestra1;
     counter + 1;
     by nnumero_de_cliente;
     if first.nnumero_de_cliente then counter = 1;
     %addTendency(&amp;varsi);
  run;
  </code></pre>
  
  <p>Of course this way <strong>is not working because it brings all the variables at the same time</strong>. It's important that if I need a loop must remain inside the other datastep.....</p>
  
  <p>I know it should be easy by I couldn't figure it out.</p>
  
  <p>Thanks!!!!</p>