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: non-mutually exclusive factors
From 
 
Nick Cox <[email protected]> 
To 
 
"'[email protected]'" <[email protected]> 
Subject 
 
RE: st: non-mutually exclusive factors 
Date 
 
Sun, 10 Oct 2010 16:59:21 +0100 
Like Steve, I am not clear what is meant, but other possibilities include 
. egen group = group(A B C)    [to create a composite variable] 
. groups A B C                 [to list combinations of categories that occur; -groups- is from SSC] 
See also 
SJ-3-4  pr0011  . . . . . . . .  Speaking Stata: Problems with tables, Part II
        . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  N. J. Cox
        Q4/03   SJ 3(4):420--439                                 (no commands)
        reviews three user-written commands (tabcount, makematrix,
        and groups) as different approaches to tabulation problems
SJ-7-4  dm0034  . . . Stata tip 52: Generating composite categorical variables
        . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  N. J. Cox
        Q4/07   SJ 7(4):582--583                                 (no commands)
        tip on how to generate categorical variables using
        tostring and egen, group()
Nick 
[email protected] 
Steve Samuels
Not sure what you mean, but maybe -tablist- ?
net describe tablist, from(http://www.ats.ucla.edu/stat/stata/ado/analysis)
Ben
> I have some factors that are not mutually exclusive and i want to bin my
> data among the various permutations of the factors.
>
> For example say there are two factors A and B.  There are 4 possibilities:
> none, A, B and AB.  For 3 factors A B & C there are 8 possible outcomes:
> none, A, B, C, AB, AC, BC, and ABC.  As the number of factors grows the
> number of permutations doubles, e.g., 5 factors have 64 permutations.
>
> Is there any clever .do file to bin cases between multiple factors?  Or
> alternatively any advice on a loop file that both bins the cases, and uses
> the factor name to create labels.  I have 5 factors I am interested in
> binning between.
>
*
*   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/