Statalist The Stata Listserver


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

Re: st: Dropping/Keeping observations


From   "Michael Blasnik" <[email protected]>
To   <[email protected]>
Subject   Re: st: Dropping/Keeping observations
Date   Sat, 22 Apr 2006 10:25:24 -0400

This approach will also drop the multiple observations for all of the other farmerIDs. Why not just:

bysort farmerID: drop if _N==1

Michael Blasnik
[email protected]


----- Original Message ----- "Maarten buis" <[email protected]> wrote:
<snip>

*---------begin example------------
sysuse auto, clear
replace rep78 = 10 in 10 /*create a unique value in rep78*/
sort rep78
list rep78 in 1/10
by rep78: keep if _n==_N & _N>1 & rep78 <.
list rep78
*----------end example--------------

--- Gauri Khanna <[email protected]> wrote:
I would like to KEEP those plots/observations
where farmerID appears more than once. Hence, I would like to DROP those
observations which have only one farmerID. Any tips?
*
*   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