Date: Tue, 4 Sep 2007 14:16:23 +0200
Reply-To: Georg.Maubach@dpwnbc.net
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: Georg Maubach <Georg.Maubach@dpwnbc.net>
Subject: CasesToVars
Content-Type: text/plain; charset="us-ascii"
Dear Listers,
we have not restructured a dataset using SPSS yet. Today we need to do
the following:
Our dataset looks basically like this:
NEW FILE .
DATA LIST FIXED
/RespID 1 Brand 5-6
f0801 9-10 f0802 13-14 f0803 17-18
Country 21 Weight 25-29 Sector 30 .
BEGIN DATA
1 11 1 1,00
1 12 1 1,00
1 13 1 1,00
1 14 1 1,00
1 15 1 1,00
1 16 10 9 9 1 1,00
1 17 8 8 8 1 1,00
1 18 1 1,00
1 19 8 8 8 1 1,00
2 11 1 1,00
2 12 7 8 6 1 1,00
2 13 7 6 7 1 1,00
2 14 1 1,00
2 15 1 1,00
2 16 8 7 8 1 1,00
2 17 1 1,00
2 18 1 1,00
2 19 1 1,00
3 11 1 1,00
3 12 10 9 10 1 1,00
3 13 1 1,00
3 14 1 1,00
3 15 1 1,00
3 16 1 1,00
3 17 2 1 4 1 1,00
3 18 1 1,00
3 19 7 7 8 1 1,00
6 11 8 8 7 1 1,00
6 12 1 1,00
6 13 1 1,00
6 14 1 1,00
6 15 1 1,00
6 16 1 1,00
6 17 1 1,00
6 18 1 1,00
6 19 1 1,00
8 11 1 0,27 1
8 12 6 10 10 1 0,27 1
8 13 1 0,27 1
8 14 1 0,27 1
8 15 5 8 8 1 0,27 1
8 16 6 10 10 1 0,27 1
8 17 1 0,27 1
8 18 1 0,27 1
8 19 1 0,27 1
9 11 1 0,98 3
9 12 10 10 10 1 0,98 3
9 13 1 0,98 3
9 14 1 0,98 3
9 15 1 0,98 3
9 16 10 10 10 1 0,98 3
9 17 1 0,98 3
9 18 1 0,98 3
9 19 1 2 1 1 0,98 3
END DATA .
EXECUTE .
The dataset shall be restructured. The resulting file should look like
this:
RespId f0801.11 f0801.12 f0801.13 f0801.14 f0801.15 f0801.16 f0801.17
f0801.18 f0801.19
f0802.11 f0802.12 f0802.13 f0802.14 f0802.15 f0802.16 f0802.17
f0802.18 f0802.19
f0803.11 f0803.12 f0803.13 f0803.14 f0803.15 f0803.16 f0803.17
f0803.18 f0803.19 Country Weight Sector.
Example of the desired strucuture for the first case:
RespID f0801.11 . . . F0801.15 f0801.16 f0801.17 f0801.18 . . . Country
Weight Sector
1 . . 10 9 9 1
. .
I tried using
SORT CASES BY Brand .
CASESTOVARS
/ID = Brand
/GROUPBY = VARIABLE .
but then all variables were changed:
Brand
Country
RespID.1
RespID.2
RespID.3
RespID.4
RespID.5
RespID.6
f0801.1
f0801.2
f0801.3
f0801.4
f0801.5
f0801.6
f0802.1
f0802.2
f0802.3
f0802.4
f0802.5
f0802.6
f0803.1
f0803.2
f0803.3
f0803.4
f0803.5
f0803.6
Weight.1
Weight.2
Weight.3
Weight.4
Weight.5
Weight.6
Sector.1
Sector.2
Sector.3
Sector.4
Sector.5
Sector.6
How do I have to use CASESTOVARS to get the desired result?
Best regards
Georg Maubach
Research Manager
|