At 08:53 AM 3/29/2007, Sara Khan wrote:
>Dear Statalisters
>
>I wish to delete all records for a subset of individuals who are first
>observed as not employed and keep those who are first observed as
>employed. Thus, in the example, below, I want to retain those with
>ID=2, 3, and 4 but delete ID 1, 5, 6, and 7. I am not sure how to do
>this and would be grateful for your help.
>
>Sara
>
>
>
>ID WAVE empstat
>------------- ---- -----------
>1 1 not emp
>------------- ---- -----------
>2 2 emp
>2 3 not emp
>------------- ---- -----------
>3 2 emp
>3 3 not emp
>------------- ---- -----------
>4 2 emp
>4 3 not emp
>------------- ---- -----------
>5 10 not emp
>5 11 not emp
>------------- ---- -----------
>6 7 not emp
>6 8 not emp
>------------- ---- -----------
>7 2 not emp
>7 3 not emp
>7 4 not emp
>7 5 not emp
>7 6 not emp
>7 7 not emp
>7 8 not emp
>7 9 not emp
>7 10 not emp
>7 11 not emp
Try this:
bysort ID (WAVE): drop if empstat[1] == "not emp"
HTH
--David
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/