Date: Mon, 7 Jun 1999 20:47:34 -0400
Reply-To: Raynald Levesque <rlevesque@VIDEOTRON.CA>
Sender: "SPSSX(r) Discussion" <SPSSX-L@UGA.CC.UGA.EDU>
From: Raynald Levesque <rlevesque@VIDEOTRON.CA>
Subject: Re: Restructuring
Content-Type: text/plain; charset="iso-8859-1"
I believe the following syntax solves your problem:
* NOTE: change all 5's in the script by the number of objects that you have.
vector obj = obj_1 to obj_5.
* convert each record to multiple records.
loop obj_idx = 1 to 5.
compute xvalue = obj(obj_idx) .
xsave outfile = 'c:\temp\temp1.sav' / keep = id obj_idx xvalue /compressed.
get file = 'c:\temp\temp1.sav' .
* rank and sort ratings of each object by id.
rank variables = xvalue by id
/ ties = low / rank into xrank .
sort cases by id xrank.
* convert from multiple records back to single records.
vector r(5) rank_n(5).
compute r(xrank) =obj_idx.
aggregate outfile = * /presorted / break = id
/rank_n1 to rank_n5 = max(r1 to r5).
formats rank_n1 to rank_n5 (f8.0).
Raynald Levesque email@example.com
----- Original Message -----
From: Thomas Otter <Thomas.Otter@WU-WIEN.AC.AT>
Sent: Monday, June 07, 1999 4:28 PM
> Dear restructuring experts,
> I have data like:
> obj_1 obj_2 obj_3 obj_4 ... obj_k
> 1 x11 x12 x13 ......... x1k
> n xnk
> The x values can take on any real valued number.
> I need to restructure the data into
> first second third fourth ... k_th
> 1 y(obj_2) y(obj_k)
> where the y(obj_?) simply indicate that it was e.g. obj_2 that
> received the lowest x-value from person 1 and obj_k receiving
> the second lowest x-value from person 1 and so
> Please let me know if you need more information.
> Thank you in advance,
> Thomas Otter