Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Re: Deleting a cohort


From   "Sergiy Radyakin" <[email protected]>
To   <[email protected]>
Subject   st: Re: Deleting a cohort
Date   Thu, 29 Mar 2007 15:04:25 +0200

gen flag=0
bys ID WAVE: replace flag=1 if empstat[1]="emp"
keep if flag==1

Sergiy

----- Original Message ----- From: "sara khan" <[email protected]>
To: <[email protected]>
Sent: Thursday, March 29, 2007 2:53 PM
Subject: st: Deleting a cohort



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
*
*   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/
*
*   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/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index