title: SAS - How to let array do loop output only once?
body: <p>The follow code with the do loop creates repeated outputs if '3320' or '3321' appears more than once in following columns. My question is how do I use a do loop w/o it outputting repeated times? The commented out OR statements solves this problem, but it's not efficient given a bigger list of variables.</p>
  
  <pre><code>options obs = 1000;
  data NIS_2013.PARKINSONS;
   set NIS_2013.NIS_2013_CORE;
   array DX (25) $ dx1--dx25;
   do i = 1 to 25;
    if DX(i) IN ('3320', '3321') then output;
   end;
  run;
  
  
  /* if DX1 IN ('3320', '3321')
  OR DX2 IN ('3320', '3321')
  OR DX3 IN ('3320', '3321')
  OR DX4 IN ('3320', '3321')
  ... */
  </code></pre>