Statalist


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

Re: st: Simultaneous occurance


From   Kyle Hood <[email protected]>
To   [email protected]
Subject   Re: st: Simultaneous occurance
Date   Tue, 18 Mar 2008 12:17:19 -0400 (EDT)

If the variables are named x1 and x2, could you not just sum them?

. gen x3 = x1 + x2

Then you get 0 when they are both zero, 1 when they differ, and 2 when they are both 1. If you want to return a 1 when x1 = x2, use

. gen x3 = ( x1 == x2 )

egen group will encode all four possible combinations

. egen x3 = group( x1 x2 )

Kyle



On Tue, 18 Mar 2008, Olga Lyashevskaya wrote:


Dear all,

There are two binary variables in my sample, where 1
is presence and 0 is absence of the particular
characteristic. I want to identify those cases where I
get either both 0's or both 1's

Any suggestions?

Thank you in advance,
Olga





     ____________________________________________________________________________________
Looking for last minute shopping deals?
Find them fast with Yahoo! Search.  http://tools.search.yahoo.com/newsearch/category.php?category=shopping
*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index