Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Keeping observations


From   "eabantom" <eabantom@minag.gob.pe>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Keeping observations
Date   Thu, 9 Jun 2005 09:45:31 -0400

Hi Paty , 
you can do it

bys id: gen x=employ if _n==1
bys id: replace x=x[_n-1] if x==.
keep if x==2
drop x

Edgard abanto


--
Ministerio de Agricultura
(http://www.portalagrario.gob.pe)


---------- Original Message -----------
From: Patricia Vera Rojas <pverarojas@yahoo.es>
To: statalist@hsphsun2.harvard.edu
Sent: Thu, 9 Jun 2005 05:40:14 +0200 (CEST)
Subject: st: Keeping observations

> Hello all,
> 
> I have :
> 
> id    employ
> 1       2
> 2       1
> 3       2
> 3       2
> 4       2
> 4       1
> 5       1
> 5       2
> 6       1
> 6       1
> 
> where id= subject identification and employ=1 if the person is employed and 
> employ=2 if the person is unemployed. I want to keep in the data those 
> subjects whose are unemployed in the first observation (employ=2) without 
> losing their second observation if they are observed more than once, that is:
> 
> id    employ
> 1       2
> 3       2
> 3       2
> 4       2
> 4       1
> 
> How can I do that?
> Thanks,
> 
> Patricia
> 
> 	
> 	
> 		
> ______________________________________________ 
> Renovamos el Correo Yahoo! 
> Nuevos servicios, más seguridad 
> http://correo.yahoo.es
> *
> *   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/
------- End of Original Message -------

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index