title: Test Based on Label of Encoded Variable
body: <p>Say I have a string variable, <code>animal</code>, that takes on values <code>dog</code>, <code>cat</code>, and <code>horse</code>. I encode this string variable to get <code>animal2</code>. How can I then test <code>animal2</code> using the label as opposed to the actual numeric values?</p>
  
  <p>In other words, I can do a logical test on <code>animal</code> as follows:</p>
  
  <pre><code>gen dog = animal=="dog"
  </code></pre>
  
  <p>But I get an error if I do the same thing with <code>animal2</code>:</p>
  
  <pre><code>gen dog2 = animal2=="dog"
  </code></pre>
  
  <p>How can I perform this test using the label? Pseudocode is as follows:</p>
  
  <pre><code>gen dog2 = label(animal2)=="dog"
  </code></pre>