Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

RE: st: obtaining a new file with all possible combinations?


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   RE: st: obtaining a new file with all possible combinations?
Date   Sat, 1 Oct 2005 17:35:11 +0100

Like Svend, I can't square the combinatorial explosion
you imply with your specific example. 

But -egen, seq()- may help with what you want. 

Nick 
[email protected] 

Svend Juul
 
> Gerben ter Riet wrote:
> 
> For 80 observations, I have information on 3 binary (0,1) variables.
> I'd like to get a file containing all possible combinations
> (80*80*80=512000). So, let's say I had
> _n var1 var2 var3
> 1   a    b    c
> 2   d    e    f
> 
> and I need a data file that contains
> 1   a    b    c
> 2   a    b    f
> 3   a    e    c
> 4   a    e    f
> 5   d    b    c
> 6   d    b    f
> 7   d    e    c
> 8   d    e    f
> 
> How may this be accomplished?
> ------------------------------------------------------------------
> 
> I am not sure what you want. You have three binary variables (0,1),
> yet you gave them the values (a,d), (b,e), and (c,f).
> 
> I can see 8 rather than 512000 possible combinations:
> 0 0 0
> 0 0 1
> 0 1 0
> 0 1 1
> 1 0 0
> 1 0 1
> 1 1 0
> 1 1 1
> and that number is unrelated to any empirical findings.
> 
> But that is probably not what you are looking for.

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