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

st: RE: Resdesigning dyadic data formats


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: Resdesigning dyadic data formats
Date   Tue, 20 Apr 2004 14:18:13 +0100

fillin c1 c2
replace x = . if _fillin
drop _fillin 

Nick 
[email protected] 

Neumayer,E
 
> 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?
> 

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