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

st: deleting duplicate observations


From   "Morris, Stephen" <[email protected]>
To   "'[email protected]'" <[email protected]>
Subject   st: deleting duplicate observations
Date   Tue, 8 Oct 2002 11:45:22 +0100

Dear Kompal,

You might like to try the following:

sort HHID
by HHID: gen occur=_n
tab occur
drop if occur>1

Hope this helps.

Steve

> Date: Tue, 8 Oct 2002 16:37:02 +1000
> From: "Kompal Sinha" <[email protected]>
> Subject: st: deleting duplicate observations
> 
> I have household level data in following format:
> HHID var1 var2
> 1     5    6
> 1     5    6
> 1     5    6
> 2     5    7
> 2     5    7
> 4     9    6
> 
> I want it in the following format now:
> HHID var1 var2
> 1     5    6
> 2     5    7
> 4     9    6
> 
> How can I retain observations with unique HHID????
> 
> Thanks in advance
> Kompal

________________________________________

Dr. Stephen Morris
Senior Lecturer in Health Economics
Imperial College Management School
53 Prince's Gate
Exhibition Road
London SW7 2PG
Tel: +44 (0)20 759 49118
Fax: +44 (0)20 7823 7685

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