title: SPSS Looping across multiple string variables to find duplicates
body: <p>I have a long list of records with text names in two columns, x1 and x2. I want to compare x2 names with x1 names and identify those that match any instance of x1 and note it in temp variable.  I've tried looping through the two columns (see syntax below) but I get a "y" at every record. </p>
  
  <p>I hope someone can show me the correct syntax.</p>
  
  <p>Thanks</p>
  
  <p>Bren</p>
  
  <pre><code>string temp(a1).
  compute temp= "n".
  vector x=x1 to x2.
  loop #i=1 TO 77700.
  loop #j = (#i+1) to 77700.
  if x(#i)=x(#j) temp = "y".
  end loop.
  end loop.
  execute.
  </code></pre>