# st: reshape question

 From Alan Acock To statalist@hsphsun2.harvard.edu Subject st: reshape question Date Mon, 01 Feb 2010 14:57:05 -0800

```Kenney, Kashy, & Cook. Dyadic Data Analysis Has a wide dataset that looks like this:

dyad 	hr1	hr2	sr1	sr2	gr1	gr2
1	1.2	.6	6	7	1	1
2	4.3	2.3	5	9	-1	-1
3	.4	.6	3	4	1	1
4	.3	.5	6	8	1	1
5	3.2	1	2	6	-1	-1
6	1.1	.8	3	8	1	1
7	2	1.5	5	7	1	1
8	.4	1.6	7	4	-1	-1
9	.3	.5	3	3	1	1
10	3.2	2	5	8	1	1
11	.8	2.1	8	5	-1	-1
12	2.3	2.5	5	7	-1	-1
13	1	2	4	6	1	1
14	2.5	1.5	6	7	1	1
15	2	.5	5	6	1	1
16	1.8	2.6	7	4	-1	-1
17	4.3	2	2	4	-1	-1
18	1	2	4	4	-1	-1
19	2.5	2.5	6	5	-1	-1
20	1	.5	3	4	-1	-1

Where the dyads are interchangeable (same sex roomates). hr1 is time roommate arbitrarily labeled 1 works on housekeeping, hr2 is same for roommate labeled 2, sr1 is roommate's 1' satisfaction, sr2 is the partner's satisfaction, gr1 and gr2 are their genders. He wants it in a sort of long format,

dyad person gr sr hr1  hr2
1        1        1  6    1.2   .6
1         2       1   7   .6    1.2
2        1       -1   5   4.3  2.3
2        2       -1   9   2.3   4.3

Dyad, person, and gr and sr are in long format, but hr1 and hr2 are not. Also, in row 1 we have hr1 then hr2 as in the wide dataset, but
in row two we have hr2 for the first person in the hr1 column and hr1 for the first person in the hr2 column.

He then runs a SAS command
proc mixed covtest;
model sr = hr1 hr2 / solution
ddfm=satterth;
repeated / type = cs subject = dyadid;

I can run
reshape long sr gr, i(dyad) j(person)
but this doesn't do the hr1 the way they need them. The results show how much a person's time (actor) doing chores influences their own satisfaction and how much a partner's time doing chores influences the actor's satisfaction.

How can I reshape the data to duplicate their result.

Alan Acock

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