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   "Svend Juul" <SJ@SOCI.AU.DK>
To   <statalist@hsphsun2.harvard.edu>
Subject   Re: st: obtaining a new file with all possible combinations?
Date   Sat, 1 Oct 2005 12:27:10 +0200

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.

Svend

________________________________________________________

Svend Juul
Institut for Folkesundhed, Afdeling for Epidemiologi
(Institute of Public Health, Department of Epidemiology)
Vennelyst Boulevard 6
DK-8000 Aarhus C,  Denmark
Phone, work:  +45 8942 6090
Phone, home:  +45 8693 7796
Fax:          +45 8613 1580
E-mail:       sj@soci.au.dk
_________________________________________________________

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index