title: Dropping observations that only appear once in panel data
body: <p>I am using Stata and have panel data with two periods, t1 and t2. I also have a unique identifier that is constant across periods if the person has responded over both periods. </p>
  
  <p>For example, if person001 completes survey in both t1 and t2, answers to each period are stored under identifier person001. This leads to two entries in the data set with the same identifier, one under t1 and one under t2.</p>
  
  <p>However, some people have only completed the survey in one period, so their identifier appears only in either t1 or t2. </p>
  
  <p>I would like a way to <code>drop</code> those that only appear in one period or the other.</p>
  
  <p>I have tried </p>
  
  <pre><code>drop if identifier[_n-1] != identifier if period == t2 
  </code></pre>
  
  <p>but this simply <code>drop</code>s all t1 observations.</p>