Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


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

RE: st: Data management


From   Jeetendra Aryal <jeetendra.aryal@umb.no>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   RE: st: Data management
Date   Thu, 21 Oct 2010 12:26:21 +0200

It is excellent!! Thank you Chris.

Jeetendra Aryal

________________________________________
From: owner-statalist@hsphsun2.harvard.edu [owner-statalist@hsphsun2.harvard.edu] On Behalf Of Chris Parker [cparker.phd2007@london.edu]
Sent: Thursday, October 21, 2010 10:26 AM
To: statalist@hsphsun2.harvard.edu
Subject: Re: st: Data management

Hi Jeetendra,

One option (I'm sure more concise options will follow) is:

bysort hhn: egen hasboth=sd(rentaltype)
drop if hasboth==0

This removes any observations where there is no variation in the
rental type across the household.

Chris

Chris Parker

________________________________

PhD Candidate | Management Science & Operations
London Business School | Regent's Park | London NW1 4SA | United Kingdom
Direct line +44 (0)20 7000 8816 | Email cparker.phd2007@london.edu

On Thu, Oct 21, 2010 at 1:41 PM, Jeetendra Aryal <jeetendra.aryal@umb.no> wrote:
>
> Dear Statalists
> I have a big data set which is as follows:
> HHN   PN    Rental type
> 1          1        1
> 1          2        0
> 1          3        0
> 2          1        1
> 2          2        1
> 3          1        1
> 3          2        0
> 3          3        1
> 4          1        1
> 4          2        1
> 4          3        1
> 5          1        0
> 5          2        1
> 5          3        1
>
> Now the question is: Each household has more than one plot of land. The household can use it or rent it out or both. I want to keep only those households which have both rental types. For example, in the above dataset I want to keep only household number 1, 3 and 5. Is there any way that I can do it easily, rather than doing manually?
> Best regards,
> Jeetendra Aryal
> *
> *   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/
>
> ______________________________________________________________________
>
> This email has been scanned by the MessageLabs Email Security System
> on behalf of the London Business School community.
> For more information please visit http://www.messagelabs.com/email
> ______________________________________________________________________

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