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

st: data manipulation - generating pairs of a list


From   Mark Manger <[email protected]>
To   [email protected]
Subject   st: data manipulation - generating pairs of a list
Date   Thu, 19 Aug 2004 19:29:26 -0700

Hi,

I'm struggling with a data manipulation problem: I have a dataset with list
of observations on a string variable and want to create pairwise
combinations. My dataset looks like this:

country1
A
B
C

I need the possible combinations so that the new dataset looks like

country1 country2
A B
A C
C B

I could take the same list in two different datasets and then use the
command "cross", but that gives me 3! combinations:

AB AC BA BC CA CB

For my purposes, AB and BA are identical. How do I create the list?

Cheers,

Mark



Mark Manger

University of British Columbia
[email protected]

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