Date: Fri, 16 Sep 2005 23:04:14 -0700
Reply-To: Michael Healy <healym@earthlink.net>
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: Michael Healy <healym@earthlink.net>
Subject: Tough data setup
In-Reply-To: <0741DA624F60AE43A659DD2264AA4A65053F37@ucsur-8.ucsur.nt.pitt.edu>
Content-type: text/plain; charset="US-ASCII"
Hi, I had to do what was seemingly a very difficult data transformation. I
wonder if anyone can suggest a simple solution. I am trying to build a
dataset in .cho format for Sawtooth Software's CBC/HB program.
I have two data sets. One data set has a set of within-subject responses.
The other data set is basically a multi-row/multi-column template which I
need to populate certain cells with--it is a template which applies to every
subject.
A simplified example:
Data set 1:
A B
999 998
Data set 2:
1 2
2 1
3 2 1
3 2 2
A 0
2 1 3
2 2 2
B 0
Goal:
1 2
2 1
3 2 1
3 2 2
999 0
2 1 3
2 2 2
998 0
And this needs to be duplicated for each row in data set 1. Phew.
My solution:
1) Read in DS2.
2) save to text.
3) re-read it but specify that it's one row of data, like:
v1 v2 v3 v4 v5 v6 v7 v8 v9 v10 v11 v12 v13 v14 v15 ..
1 2 2 1 3 2 1 3 2 2 A 0 2 1 3 ..
4) Match it with ds1
a b v1 v2 v3 v4 v5 v6 v7 v8 v9 v10 v11 v12 v13 v14 v15 ..
999 998 1 2 2 1 3 2 1 3 2 2 A 0 2 1 3 ..
5) populate v11 (A) and (B) vars
a b v1 v2 v3 v4 v5 v6 v7 v8 v9 v10 v11 v12 v13 v14 v15 ..
999 998 1 2 2 1 3 2 1 3 2 2 999 0 2 1 3 ..
6) save as text, reread in original 3 column structure.
Surely there's got to be a better way!
Thanks,
Mike Healy