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

st: Just another data reshaping problem


From   Sascha Robert <[email protected]>
To   STATA List <[email protected]>
Subject   st: Just another data reshaping problem
Date   Fri, 22 Apr 2005 15:28:04 +0200

Hi,

Complex data reshaping unfortunately seems to lie beyond my logical capabilities... so anyone up to a little brain-teaser?

My data (simplified) looks like this:

time group_1 ID_g1 group_2 ID_g2
1 0 1 1 2
1 0 1 1 3
1 0 2 1 1
1 1 1 0 1
2...
and so on.

The data says something like (for the first row:) At time 1, ID 1 of group 0 encountered ID 2 of group 2. Note that an encounter always involves two entities of two different groups.

I would like to reshape the data to the form:

group ID num_encounters(*)
0 1 x
0 2 y
1 1 z
...

(*)sum of ALL dyadic encounters where ID participated

Any hint is warmly welcomed.
Sascha

--
***** sascha robert | mailto: [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