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.

# Re: st: Determining mutual exclusivity for a series of dummy variables.

 From Stephen Cranney To statalist@hsphsun2.harvard.edu Subject Re: st: Determining mutual exclusivity for a series of dummy variables. Date Fri, 8 Mar 2013 17:13:39 -0500

```The egen solution worked great. Thanks all!

On Fri, Mar 8, 2013 at 3:30 PM, Jeremy Page <miahpage@gmail.com> wrote:
> Dear Stephen,
>
> I find the command -tablist- (findit tablist) helpful in these
> situations. Below is an excerpt from the help file.
>
> The tablist command is useful when you want to make crosstabs of
> variables but you want the results to be in a list type format.  An "n" way
> crosstab implies the need for some kind of an "n" way table.  Instead,
> tablist treats each variable as a column makes an "n" way table by using
> "n" columns for the variables.  This is especially useful when each variable
> has a small number of values, since this can yield a very compressed table
> summarizing the data.
>
>
> Best,
> Jeremy
>
>
>
> On Fri, Mar 8, 2013 at 1:49 PM, Nick Cox <njcoxstata@gmail.com> wrote:
>>
>> That's the first thing I thought of too.
>>
>> Another thing is to look at the correlation matrix using -correlate-.
>>
>> The diagonal is all 1s as usual. A variable out of line will have
>> correlations distinct from others in the same row and column, or so
>> experiment indicates.
>>
>> Nick
>>
>> On Fri, Mar 8, 2013 at 6:40 PM, Richard Goldstein
>> <richgold@ix.netcom.com> wrote:
>> > assuming you have 20 variables each coded 0/1, use -egen- with the
>> > rowtotal option to get sum per unit across the 20; you could also check
>> > the min/max values of the variables (to see if any have codes other than
>> > 0/1) using rowmin/rowmax (or using -assert- as a different strategy
>> >
>> > Rich
>> >
>> > On 3/8/13 1:35 PM, Stephen Cranney wrote:
>> >> Hi all, quick question. I have about twenty separate dummy variables
>> >> that, in theory, are supposed to be mutually exclusive. I did a
>> >> regression with all the variables and it didn't kick out one of the
>> >> variables automatically, so I assume that there is either some overlap
>> >> or there are cases with zero values for all the variables. I checked
>> >> the cases used in the regression using the "estimates store sample"
>> >> command, and none of them have zero values for all the dummy
>> >> variables, which leads me to believe that they aren't mutually
>> >> exclusive. I've checked my coding numerous times and the coding for
>> >> the variables seems accurate.
>> >> So my question is: is there a parsimonious way to quickly check
>> >> whether the series of dummy variables are mutually exclusive without
>> >> having to check every combination by hand?
>> *
>> *   For searches and help try:
>> *   http://www.stata.com/help.cgi?search
>> *   http://www.stata.com/support/faqs/resources/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/faqs/resources/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/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/
```