Date: Wed, 28 Sep 2005 20:37:40 -0400
Reply-To: Richard Ristow <wrristow@mindspring.com>
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: Richard Ristow <wrristow@mindspring.com>
Subject: Re: Recoding
In-Reply-To: <20050928181055.EA95FB4847E@smtpgate.email.arizona.edu>
Content-Type: text/plain; charset="us-ascii"; format=flowed
At 02:10 PM 9/28/2005, Jean Campbell wrote:
>I have two separate variables that list a person's profession, one is
>a string variable and the other is numeric. I want to recode both
>variables into one new variable "profession." But so far I can only
>recode one variable at a time into a new variable...
And, at 03:02 PM 9/28/2005, expanded:
>My goal is to recode all of my profession data into one of the
>following categories:
>
>1. Healthcare-medical
>2. Healthcare-behavioral
>3. Other human services
>
>The first two are from a list presented to the person filling it in,
>the third category comes from a combination of other [choices on the
>list] AND a write in "other" option:
>
>1 healthcare-medical
>2 healthcare-behav
>3 social worker
>4 manager/hr
>5 student
>6 retired
>Etc...
>12
>13 Other (specify _________)
>
>[So,] there are two variables: one that represents any of the 12
>possible professions (numeric) and one that represents a write-in
>response (string).
>
>I want to have everyone who choose "healthcare-medical" and everyone
>who wrote in something I adjudicate as "healthcare-medical" to be
>recoded to "1." [,etc.]
OK, you're adjudicating. So you can't recode from the string variable;
you need a new variable, which I'll call B1, which gives the category
you've assigned to that individual's "Other" response. Would something
like this work?
NUMERIC B2 (F3).
VAR LABEL B2 'Professional category, assigning written-in "Other"
responses'.
VAL LABEL B2
1 'healthcare-medical'
2 'healthcare-behav'
3 'social worker'
4 'manager/hr'
5 'student'
6 'retired'
Etc...
12
13 'Unclassifiable'.
DO IF MISSING(A) AND MISSING(B1).
. COMPUTE B2 = $SYSMIS.
ELSE IF MISSING(A) OR A EQ 13.
. COMPUTE B2 = B1.
ELSE.
. COMPUTE B2 = A.
END IF.
Then, if I've got the logic right (not checked), B2 is the best
assignment you have, of each person to one of the categories. (Note
category 13, for people you couldn't assign.)
Then, if you want to combine categories,
RECODE B2
<specifications>
INTO <whatever>.