Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: RE: ST: delete duplicate observations


From   "Martin Weiss" <martin.weiss1@gmx.de>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: ST: delete duplicate observations
Date   Sat, 12 Sep 2009 21:38:46 +0200

<>

**************
bysort ID: keep if_n==1
**************


HTH
Martin

-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Laura Platchkov
Sent: Samstag, 12. September 2009 20:45
To: statalist@hsphsun2.harvard.edu
Subject: st: ST: delete duplicate observations

Dear all, 

I have a dataset with 200'000 observations, and a lot of observation have
the same ID. I want to keep only 1 observation of each ID, lets say the
first one that have this particular ID. 

My dataset is like this: 

ID  variable Z

1     45.6
1     46.7
1     47.8
1     .
2      .
2
2
3
4
5
5
5
5


An I want to transform the dataset like this: 
1      45.6
2
3
4

Does anyone has the magic command for that???

Laura 

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   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