Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: st: Re: Dropping Observations
From
Neil Shephard <[email protected]>
To
[email protected]
Subject
Re: st: Re: Dropping Observations
Date
Tue, 9 Nov 2010 17:42:06 +0000
On Tue, Nov 9, 2010 at 5:36 PM, momo <[email protected]> wrote:
> Anyway thank you, but as I said before in the message if I put
> drop var11 if (var11==var5)
>
> to clarify the problem
> I have say a 10000 companies data and each company has (code(var5) total
> number of affiliates(var10) and code for each affiliate (var11))
>
> so I need to drop the affiliates that have the same code of the main
> company(headquarter))
>
> drop var11 if (var11==var5) or drop var11 if (var11==var5) do not work
>
> I think I have to include something to say "for each company" but how
Read the help for -drop- again and look at the syntax examples at the top.
"drop eliminates variables OR observations from the data in memory."
You're trying to do both at once, so if you want to remove instances
where var11 and var 5 match _and_ get rid of var11 you have to...
drop if(var11 == var5)
drop var11
Neil
--
"Our civilization would be pitifully immature without the intellectual
revolution led by Darwin" - Motoo Kimura, The Neutral Theory of
Molecular Evolution
Email - [email protected]
Website - http://kimura-no-ip.org/
Photos - http://www.flickr.com/photos/slackline/
*
* 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/