Statalist


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

Re: st: identifying observations in one variable that appear in another variable


From   "Sergiy Radyakin" <serjradyakin@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: identifying observations in one variable that appear in another variable
Date   Wed, 29 Aug 2007 18:17:45 -0400

There is a multiple way of doing it, but see -help merge- if you are
building some sort of relational DB. (will work similar to linking
tables in Access).

If you have a single dataset, then -levelsof- gives you the distinct
values of a variable. You can test for each value of one variable if
it occurs in another. See -help levelsof- and -help macro-.

sysuse auto
levelsof make, local(m)
local v=`"`"Volvo 260"'"'
di `: list v in m'
local v=`"`"Volvo S70"'"'
di `: list v in m'

Regards, Sergiy

On 8/29/07, Dalhia <ggs_da@yahoo.com> wrote:
> hi, I am trying to figure out a way to identify all
> observations in one variable that also appear in
> another variable.  I have two variables - shareholder
> name and company name and I'm trying to find all the
> shareholders who are also on my list of companies.  Is
> there a way to do this in Stata?
>
> Thanks so much for your help on this. I appreciate it.
>
> Dalhia Mani
>
>
>
> ____________________________________________________________________________________
> Got a little couch potato?
> Check out fun summer activities for kids.
> http://search.yahoo.com/search?fr=oni_on_mail&p=summer+activities+for+kids&cs=bz
> *
> *   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/
>
*
*   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