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

st: Resdesigning dyadic data formats


From   "Neumayer,E" <E.Neumayer@lse.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: Resdesigning dyadic data formats
Date   Tue, 20 Apr 2004 14:13:10 +0100

Dear all,

I have a "dyadic" dataset that looks like this (which is the traditional way of setting up such data):

c1	c2	x
1	2	567
1	3	345
1	4	7
1	5	348
2	3	47
2	4	3
2	5	48
3	4	23424
3	5	347
4	5	234

The "c1" and "c2" are identifiers for the two dyads. I would like to re-design the data to have it in the following format:

c1	c2	x
1	1	
1	2	567
1	3	345
1	4	7
1	5	348
2	1	567
2	2	
2	3	47
2	4	3
2	5	48
3	1	345
3	2	47
3	3	
3	4	23424
3	5	347
4	1	7
4	2	3
4	3	23424
4	4	
4	5	234
5	1	348
5	2	48
5	3	347
5	4	234
5	5	

Note that now the identical pairs (1-1, 2-2, 3-3, 4-4, 5-5) have missing x-values, of course, and that all x-values exist twice now (e.g., once for 1-5, and once for 5-1). I know, one could do this redesigning by hand, but given that my actual dataset is far bigger, I am looking for a way to let Stata do the work for me. Any ideas?

Many thanks in advance for all help! Best, Eric Neumayer

Dr. Eric Neumayer

Senior Lecturer in Environment & Development
London School of Economics (LSE)
Department of Geography and Environment, Room S416
Houghton Street
London WC2A 2AE
+44-20-7955-7598 (phone)
+44-20-7955-7412 (fax)
Email: E.Neumayer@lse.ac.uk
Website: http://www.lse.ac.uk/Depts/geography/Eric1.htm




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