Bookmark and Share

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: creating combinations of all 49 variables and counting their frequencies


From   Nick Cox <[email protected]>
To   "[email protected]" <[email protected]>
Subject   Re: st: creating combinations of all 49 variables and counting their frequencies
Date   Sun, 2 Mar 2014 10:44:46 +0000

If you did use a -str49- variable, you might have difficulty showing
it in -tabulate-.

Regardless of that, some basic technique, assuming binary variables
-bin1-bin49-:

bysort bin1-bin49 : gen freq = _N

egen group = concat(bin1-bin49)

egen tag = tag(group)

list group freq if tag & freq > 42

The last can clearly be varied for "any value of 42".

l


Nick
[email protected]


On 2 March 2014 09:00, Nick Cox <[email protected]> wrote:
> In principle there are 2^49 possible combinations but that number will
> greatly exceed the size of your dataset and there is not much point
> listing many, many that don't occur. -groups- (SSC) will show you
> empirical frequencies but with the variables as 49 separate variables
> display may be problematic. I'd concatenate the 49 variables to a
> -str49- (e.g. using -egen, concat()-) and then you can just -tabulate,
> sort-.
>
> Matters of form: "Stata", not "STATA"; -tuples- is from SSC.
>
> Nick
> [email protected]
>
>
> On 2 March 2014 05:09, Krisha Lim <[email protected]> wrote:
>
>> I have 49 binary variables. I am interested in doing all combinations for those 49 variables and calculating the frequencies. I am not sure how to do this in STATA. The tuples command just generates all the tuples but it stopped after the 9999999 tuples. Would you be able to help me?
>>
>> To give a context, each binary variable indicates adoption (so 1= adopt). I want to figure out the most used technique or combination of techniques used in my dataset. I know this will be a very very large number, but hope there's a way to do it.

*
*   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/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index