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: Identify combinations without respect to the order of the elements
From
Oliver Jones <[email protected]>
To
[email protected]
Subject
Re: st: Identify combinations without respect to the order of the elements
Date
Wed, 13 Jul 2011 20:28:11 +0200
Hi everybody,
someone just sent me an solution to my private email:
------------------------------------------------------------------------------------------
One way to solve the problem would be to create two new variables which have a standard order
for the cities. Then you can use egen group to identify the pairs.
That is:
gen first = var1 if var1 <= var2
replace first = var2 if first == ""
gen second = var2 if var1 <= var2
replace second = var1 if second == ""
egen paired = group(first second)
------------------------------------------------------------------------------------------
To my example with the cities var1 would be the variable from and var2 would be the
variable to.
Best
Oliver
--
Universität Bielefeld
Fakultät für Wirtschaftswissenschaften
Lehrstuhl für Ökonometrie und Statistik
- -
Bielefeld University
Faculty of Business Administration and Economics
Chair of Econometrics and Statistics
- -
Raum / room: V9-110
Tel / phone: +49 (0)521 106 4871
---
*
* 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/