Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Data Restructuring

2 views
Skip to first unread message

Dave

unread,
Dec 17, 2009, 4:31:23 PM12/17/09
to
I have a dataset containing social network variables that I would like
to restructure. The data are currently structured this way:

Participant Person1Wave1 Person2Wave 1 Person3Wave1 Person1Wave2
Person2Wave2 Person3Wave2
1 Joe
Jeff Jim Jim
Jeff Joe
2 Kelly Mike
Mark Mike Mark Joe
3 John David
Shelly David Shelly John

What I would like to do is restructure the data so that all Wave 1
persons are listed in one column for each participant and wall wave 2
persons are listed in another column. For example:

Participant Person Wave 1 Wave 2
1 1 Joe Jim
1 2 Jeff Jeff
1 3 Jim Joe
2 1 Kelly Mike
2 2 Mike Mark
2 3 Mark Joe
3 1 John David
3 2 David Shelly
3 3 Shelly John

Unfortunately, I'm having trouble getting the Data-Transform function
to work as I would like. Do I need to create an index variable labeled
"Person"? Any help you could give on how to carry this out would be
appreciated.

Bruce Weaver

unread,
Dec 17, 2009, 5:58:07 PM12/17/09
to

Do you mean Data - Restructure? You should be using VARSTOCASES
here. E.g.,

* Read in the initial data.

data list list / Participant (f3.0) P1W1 P2W1 P3W1 P1W2 P2W2 P3W2
(6a10).
begin data


1 Joe Jeff Jim Jim Jeff Joe
2 Kelly Mike Mark Mike Mark Joe
3 John David Shelly David Shelly John

end data.

* Restructure from WIDE to LONG format .

VARSTOCASES
/MAKE Wave1 FROM P1W1 P2W1 P3W1
/MAKE Wave2 FROM P1W2 P2W2 P3W2
/INDEX=Person(3)
/KEEP=Participant
/NULL=KEEP.

list.

--
Bruce Weaver
bwe...@lakeheadu.ca
http://sites.google.com/a/lakeheadu.ca/bweaver/Home
"When all else fails, RTFM."

0 new messages