Date: Fri, 12 Jun 2009 13:31:14 -0400
Reply-To: Gene Maguin <emaguin@buffalo.edu>
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: Gene Maguin <emaguin@buffalo.edu>
Subject: Re: ranking syntax
In-Reply-To: <FD864CB3CC3CFD4DB6F8B5B1C87C9E14064B5A9F@sato.evms.net>
Content-Type: text/plain; charset="us-ascii"
Richard,
A realy simple way to do this, provided you don't have too many cases, and
even then, I'd guess, it could be done in stages, is use the Flip command to
flip the dataset so that variables are now rows and subjects are now columns
(and, thus, variables). Next, use the Rank command to rank the variables.
Finally, use the Flip command again to restore the dataset to its original
structure. I haven't done this in a long time but I'll bet others have and
can comment. Try this out and see if it will work for you. Post back and let
us know.
The alternative is to write syntax to do a within cases sort and while that
is not too hard, accounting for ties and for missing data makes the code
complex.
Gene Maguin
>>1) Take 10 variables (x1 to x10) that have integer values between 30 and
100.
2) Create syntax that rank orders these variables and writes them out to a
second set of variables based on rank order (in ascending order). In other
words, the second set of variables would indicate the relative standing of
each case (X1 to X10). (Let's say the second set of variables is named X1a
to X10a.)
So, it would end up like this (I will limit it to 3 variables for this
example):
Input data:
X1 = 50
X2 = 70
X3 = 55
New Variable:
X1a = 1
X2a = 3
X3a = 2.
The more complicated issue is that a tie needs to be assigned a mid-point
value. So, if
Input data:
X1 = 50
X2 = 50
X3 = 70
Then,
X1a = 1.5
X2a = 1.5
X3a = 3
(That is, X3 is still the third highest score.)
=====================
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