Date: Fri, 10 Sep 2010 11:19:22 -0500
Reply-To: Rick Oliver <oliverr@us.ibm.com>
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: Rick Oliver <oliverr@us.ibm.com>
Subject: Re: Rank Variables Equivalent for String Variables
In-Reply-To: <AANLkTim8Ci2Z-DBBJuw9vXyDt_aEnV1UV8RWuup0u4kY@mail.gmail.com>
Content-Type: multipart/alternative;
You could concatenate first and last name and use autorecode:
DATA LIST LIST /client_no (F11.0) last_name (A15) first_name (A15).
BEGIN DATA
773821 Doe John
4072419 Johnson Joe
4072419 Johnson Joe
4072419 Johnson Joe
771763 Smith Steve
771763 Smith Steve
END DATA.
string fullname (a30).
compute fullname=concat(ltrim(last_name), ltrim(first_name)).
autorecode fullname /into rankvar.
delete variables fullname.
From:
Ariel Barak <abarakabarak@gmail.com>
To:
SPSSX-L@LISTSERV.UGA.EDU
Date:
09/10/2010 10:59 AM
Subject:
Rank Variables Equivalent for String Variables
Sent by:
"SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
Hi All,
I have what should be an easy problem. I am interested in keeping records
sorted by multiple string variables, last_name and first_name, and then
creating a record number that starts at 1 and increases only if the
last_name and first_name from the record above are different and otherwise
stays the same. In the dummy data below, the record number would be 1, 2,
2, 2, 3, 3. If I were to sort on the client_no, I could use the Rank
command but I am interested in sorting the data by the string variables in
order to use the conditional format functionality in an MS Access report
so that each group of record numbers will alternate from being white (no
fill) and gray based on whether the record number is odd or not.
Thanks,
Ariel Barak
DATA LIST LIST /client_no (F11.0) last_name (A15) first_name (A15).
BEGIN DATA
773821 Doe John
4072419 Johnson Joe
4072419 Johnson Joe
4072419 Johnson Joe
771763 Smith Steve
771763 Smith Steve
END DATA.
[text/html]
|