title: What is a solution to test if a string contains a specific sub string in SAS?
body: <p>I am trying to figure out how to test in a SAS DATA step if a variable value is contained in a string.
  Let say I have the following:</p>
  
  <pre><code>Variable='some string'
  
  String='ABC;EFG;IJKL;MNOPQ'.
  </code></pre>
  
  <p>I want to build a test returning 'OK' if:</p>
  
  <ul>
  <li><p>Variable='ABC'</p></li>
  <li><p>Variable='EFG'</p></li>
  <li><p>Variable='IJKL'</p></li>
  <li><p>Variable='MNOPQ'</p></li>
  </ul>
  
  <p>Returning 'NOT OK' otherwise;</p>
  
  <p>I have the following code:</p>
  
  <pre><code>FIND(String,TRIM(Variable)) GE 1 THEN PUT 'OK';
  </code></pre>
  
  <p>The previous line would make the test return OK if </p>
  
  <pre><code>Variable = 'AB' ;
  
  Variable = 'G;IJKL;M' ;
  
  Variable = ';' ;
  </code></pre>
  
  <p>...</p>
  
  <p>Which is not what I want.</p>
  
  <p>Do you have any idea ?
  Thank You</p>