Statalist The Stata Listserver


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

Re: st: Dropping/Keeping observations-25 April


From   "Gauri Khanna" <gwkhanna@hotmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Dropping/Keeping observations-25 April
Date   Tue, 25 Apr 2006 16:15:05 +0000

Dear Marten and Michael,

Thank you for your suggestions. I tried both of your methods, one of them worked whereas the other did not.

I tried Michaelís approach and typed
bysort fid: drop if _N==1
*113 farmers remained in the dataset and 49 plots with only one farmer id were dropped.

I decided to try Maartenís method but admit that I donít understand completely what I am doing. So I followed the instructions exactly
(pseudopanel is the name of my dataset)

. sysuse pseudopanel, clear

. drop if stype==2
(164 observations deleted) ( I need to do for another reason, needed to eliminate plots on which another crop was being grown. So now I am down to the crop if interest and have data on plots where some farmerís id appear only once and I need to get rid ot)

. replace fid = 10 in 10 /*create a unique value in fid*/
(1 real change made)
Gauri: what does this mean ?

. sort fid

. list fid in 1/10

+-----+
| fid |
|-----|
1. | 1 |
2. | 2 |
3. | 2 |
4. | 3 |
5. | 3 |
|-----|
6. | 3 |
7. | 4 |
8. | 4 |
9. | 5 |
10. | 6 |
+-----+

. by fid: keep if _n==_N & _N>1 & fid <.
(110 observations deleted)
Gauri: only 49 plots had one fid (farmerid) associated with it. So this has dropped moreÖ
. list fid

+-----+
| fid |
|-----|
1. | 2 |
2. | 3 |
3. | 4 |
4. | 7 |
5. | 8 |
|-----|
6. | 9 |
7. | 10 |
8. | 14 |
9. | 15 |
10. | 17 |
|-----|
11. | 18 |
12. | 20 |
13. | 22 |
14. | 24 |
15. | 26 |
|-----|
16. | 28 |
17. | 29 |
18. | 37 |
19. | 38 |
20. | 39 |
|-----|
21. | 40 |
22. | 42 |
23. | 44 |
24. | 45 |
25. | 56 |
|-----|
26. | 57 |
27. | 58 |
28. | 59 |
29. | 60 |
30. | 61 |
|-----|
31. | 62 |
32. | 65 |
33. | 66 |
34. | 67 |
35. | 71 |
|-----|
36. | 72 |
37. | 73 |
38. | 74 |
39. | 75 |
40. | 77 |
|-----|
41. | 79 |
42. | 81 |
43. | 82 |
44. | 83 |
45. | 84 |
|-----|
46. | 86 |
47. | 87 |
48. | 94 |
49. | 96 |
50. | 97 |
|-----|
51. | 100 |
52. | 104 |
+-----+

. end

Thank you for your attention.

Gauri Khannahttp://by112fd.bay112.hotmail.msn.com/cgi-bin/compose?type=ra&msg=8C9D4C50-FB3B-462C-93C1-2A9D272E3642&start=0&len=3915&curmbox=00000000%2d0000%2d0000%2d0000%2d000000000001&a=8e97f2d6d33d18578baf68a0a3ed45384c41aec0fe9eddec68c6538b2d47993f#
Send



From: Maarten buis <maartenbuis@yahoo.co.uk>
Reply-To: statalist@hsphsun2.harvard.edu
To: statalist@hsphsun2.harvard.edu
Subject: Re: st: Dropping/Keeping observations
Date: Sat, 22 Apr 2006 16:50:59 +0100 (BST)

I was not exactly sure about what Gauri wanted to do with these observations sso I thought to give
her multiple options to choose from.

--- Michael Blasnik <michael.blasnik@verizon.net> wrote:
> This approach will also drop the multiple observations for all of the other
> farmerIDs. Why not just:
>
> bysort farmerID: drop if _N==1


-----------------------------------------
Maarten L. Buis
Department of Social Research Methodology
Vrije Universiteit Amsterdam
Boelelaan 1081
1081 HV Amsterdam
The Netherlands

visiting adress:
Buitenveldertselaan 3 (Metropolitan), room Z214

+31 20 5986715

http://home.fsw.vu.nl/m.buis/
-----------------------------------------



___________________________________________________________
Switch an email account to Yahoo! Mail, you could win FIFA World Cup tickets. http://uk.mail.yahoo.com
*
* 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/
_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/

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