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

RE: st: Keeping observations


From   "Svend Juul" <SJ@SOCI.AU.DK>
To   <statalist@hsphsun2.harvard.edu>
Subject   RE: st: Keeping observations
Date   Thu, 9 Jun 2005 11:35:29 +0200

Patricia,

The following commands will do. The purpose of -obsno- is to make sure
that the sort order within subjects is preserved; you might have a date
variable to take care of that.

--------------------------------------
gen obsno=_n
sort id obsno
by id: gen emp2=2 if employ[1]==2
keep if emp2==2
--------------------------------------

Hope this helps

Svend
__________________________________________

Svend Juul
Institut for Folkesundhed, Afdeling for Epidemiologi
(Institute of Public Health, Department of Epidemiology)
Vennelyst Boulevard 6
DK-8000  Aarhus C, Denmark
Phone: +45 8942 6090
Home:  +45 8693 7796
Email: sj@soci.au.dk
__________________________________________ 

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