Statalist The Stata Listserver


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

st: keeping an inventory of dropped observations


From   Michael McCulloch <mm@pinest.org>
To   statalist@hsphsun2.harvard.edu
Subject   st: keeping an inventory of dropped observations
Date   Thu, 29 Mar 2007 17:52:55 -0700

Hello,
While cleaning a dataset, I'm periodically dropping observations that meet certain criteria, for example:
drop if eodlymph==99

Since this occurs very often within a long do-file, I'd like to keep an inventory of dropped observations & my reason for doing so. Aside from manually searching through my log file, is there a more elegant way than what I suggest below, to do this?

For example:
gen mark_for_drop=0
gen reason_for_drop=.
replace mark_for_drop=1 if eodlymph==99
replace reason_for_drop="missing lymph" if eodlymph==99
...
drop if eodlymph==99
...
tab mark_for_drop reason_for_drop if reason_for_drop==1


Many thanks,
Michael



--

Michael McCulloch, LAc, MPH
Research Director
Pine Street Foundation
124 Pine St
San Anselmo, CA 94960-2674
Tel: (415) 407-1357
Fax: (415) 485-1065
mcculloch@pinestreetfoundation.org
*
* 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