Date: Wed, 16 Jan 2008 14:24:49 -0500
Reply-To: "Katkowski, David" <David.Katkowski@ddiworld.com>
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: "Katkowski, David" <David.Katkowski@ddiworld.com>
Subject: Re: Restructuring Data
In-Reply-To: A<918918346@web.de>
Content-Type: text/plain; charset="windows-1250"
Run the following syntax. Should fix your data exactly the way you want it:
SORT CASES BY id Varstr .
CASESTOVARS
/ID = id
/INDEX = Varstr
/GROUPBY = VARIABLE
/VIND ROOT = ind.
The only difference is that each of the Varstr variables has a prefix added to it.
-----Original Message-----
From: SPSSX(r) Discussion [mailto:SPSSX-L@LISTSERV.UGA.EDU] On Behalf Of Michael Schuler
Sent: Wednesday, January 16, 2008 11:46 AM
To: SPSSX-L@LISTSERV.UGA.EDU
Subject: Restructuring Data
Dear Experts,
I've got a question concerning restructering a Dataset. The Data are looking like that:
Id Varstr
1 Text1
1 Text2
1 Text3
1 Text4
2 Text5
2 Text2
2 Text6
3 Text3
4 Text1
4 Text5
... ...
So I have multiple Measurements for each case, but different numbers of Measurments.
The Measurement ("Varstr") is string format.
After Restructuring, Data schould look like ... :
Id Text1 Text2 Text3 Text4 Text5 ...
1 1 1 1 1 0
2 0 1 0 0 1
3 0 0 1 0 0
4 1 0 0 0 1
I want to have one line per Id. The Names of the new (binary) Variables should be the Texts of
the old variable "Varstr.".
I have hundreds of different Measuments (e.g. "Text1"... "Text820") and thousands of cases and
don't want to create every new variable with hundreds of simple if-statements but i can't figure out
how to solve the problem with a short (Macro)Syntax.
Any help would be appreciated.
Thanks,
Michael
_______________________________________
GRATIS: Movie-FLAT. Jetzt freischalten!
http://freemail.web.de/club/maxdome.htm
=====================
To manage your subscription to SPSSX-L, send a message to
LISTSERV@LISTSERV.UGA.EDU (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.516 / Virus Database: 269.19.5/1228 - Release Date: 1/16/2008 9:01 AM
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.516 / Virus Database: 269.19.5/1228 - Release Date: 1/16/2008 9:01 AM
=====================
To manage your subscription to SPSSX-L, send a message to
LISTSERV@LISTSERV.UGA.EDU (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD