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 <>
Subject   st: keeping an inventory of dropped observations
Date   Thu, 29 Mar 2007 17:52:55 -0700

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 McCulloch, LAc, MPH
Research Director
Pine Street Foundation
124 Pine St
San Anselmo, CA 94960-2674
Tel: (415) 407-1357
Fax: (415) 485-1065
* For searches and help try:

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