title: Identifying CharacterStrings with Arrays and Index Function SAS
body: <p>I have several (55 to be exact) variables in my dataset that are large blocks of text. These variables hold the results of certain medical procedures.</p>
  
  <p>I am trying to use the index function in combination with an array in SAS to identify observation where certain key words are present in one or more of the 55 results variables. For example, where the word "REPAIR" is present.</p>
  
  <pre><code>data c1;
  set c; 
  
    array res  results1-results55; 
  
    array outres _numeric_; 
  
        do i= 1 to dim(outres);
  
        outres(i) = index(res(i), "REPAIR");
  
        end; 
  
    run; 
  </code></pre>
  
  <p>I can get my code to work when only one variable is being indexed; however, it breaks when trying to use an array to look across all 55 results variables for the word "REPAIR". I get the following error:</p>
  
  <pre><code>         ERROR: Array subscript out of range at line 1338 column 19.
  </code></pre>
  
  <p>Any thoughts on how to debug this?</p>
  
  <p>THANKS!</p>