Recode Multiple Variables into One Variable?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Recode Multiple Variables into One Variable?

Justin Meyer-3
Hi SPSS listers,

 

I want to recode seven variables into one variable. Each of the seven
variables indicates a racial group, with 1=the student belongs to the
racial group and 0=the student does not belong to the racial group. I
want to turn the seven variables into one variable, with 1=Native
American, 2=Asian, 3=African American, and so on. In addition, I would
like 8=Multiracial (student marked more than one race) and 999=missing
(student didn't mark any race). Can anyone suggest a method for doing
this? I did attempt a few things and tried some searching, but I am out
of ideas. Thanks for your help!

 

____________________________________

Justin Meyer

Researcher

Rowland Reading Foundation

1 South Pinckney Street, Suite 324

Madison, WI  53703

phone: 866-370-7323  fax: 608-204-3846

www.rowlandreading.org <http://www.rowlandreading.org/>

____________________________________

====================To manage your subscription to SPSSX-L, send a message to
[hidden email] (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
Reply | Threaded
Open this post in threaded view
|

Re: Recode Multiple Variables into One Variable?

ariel barak
Hi Justin,

Assuming your racial group variables are numeric, the syntax below
works...if they're string, convert them to numeric and the syntax will work.
There may be a more elegant way of doing this but oh well.

-Ariel

**************************************************************.
* Define some dummy data to work with.
DATA LIST FREE /id white black asian hispanic native .
BEGIN DATA
01547 1 0 0 0 0
01471 0 1 0 0 0
01931 0 0 1 0 0
05974 0 0 0 1 0
06471 0 0 0 0 1
05411 1 0 0 1 0
03418 0 0 0 0 0
END DATA.

COMPUTE race=0.

IF white=1 race=1.
IF black=1 race=2.
IF asian=1 race=3.
IF hispanic=1 race=4.
IF native=1 race=5.
IF (SUM(white TO native)>1) race=8.
IF (SUM(white TO native)=0) race=999.
EXE.

VALUE LABELS race
1 White
2 Black
3 Asian
4 Hispanic
5 NativeAmerican
8 Multiracial
999 Sysmis.
**************************************************************.

On Mon, Jul 21, 2008 at 4:28 PM, Justin Meyer <
[hidden email]> wrote:

> Hi SPSS listers,
>
>
>
> I want to recode seven variables into one variable. Each of the seven
> variables indicates a racial group, with 1=the student belongs to the
> racial group and 0=the student does not belong to the racial group. I
> want to turn the seven variables into one variable, with 1=Native
> American, 2=Asian, 3=African American, and so on. In addition, I would
> like 8=Multiracial (student marked more than one race) and 999=missing
> (student didn't mark any race). Can anyone suggest a method for doing
> this? I did attempt a few things and tried some searching, but I am out
> of ideas. Thanks for your help!
>
>
>
> ____________________________________
>
> Justin Meyer
>
> Researcher
>
> Rowland Reading Foundation
>
> 1 South Pinckney Street, Suite 324
>
> Madison, WI  53703
>
> phone: 866-370-7323  fax: 608-204-3846
>
> www.rowlandreading.org <http://www.rowlandreading.org/>
>
> ____________________________________
>
> To manage your subscription to SPSSX-L, send a message to
> [hidden email] (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
>

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (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
Reply | Threaded
Open this post in threaded view
|

Re: Recode Multiple Variables into One Variable?

Justin Meyer-3
In reply to this post by Justin Meyer-3
Thanks to everyone who responded to my question both on the list and
off. I think I should be able to get everything into one variable now.

 

____________________________________

Justin Meyer

Rowland Reading Foundation

phone: 866-370-7323  fax: 608-204-3846

____________________________________

From: Justin Meyer
Sent: Monday, July 21, 2008 4:28 PM
To: [hidden email]
Subject: Recode Multiple Variables into One Variable?

 

Hi SPSS listers,

 

I want to recode seven variables into one variable. Each of the seven
variables indicates a racial group, with 1=the student belongs to the
racial group and 0=the student does not belong to the racial group. I
want to turn the seven variables into one variable, with 1=Native
American, 2=Asian, 3=African American, and so on. In addition, I would
like 8=Multiracial (student marked more than one race) and 999=missing
(student didn't mark any race). Can anyone suggest a method for doing
this? I did attempt a few things and tried some searching, but I am out
of ideas. Thanks for your help!

 

____________________________________

Justin Meyer

Researcher

Rowland Reading Foundation

1 South Pinckney Street, Suite 324

Madison, WI  53703

phone: 866-370-7323  fax: 608-204-3846

www.rowlandreading.org <http://www.rowlandreading.org/>

____________________________________

====================To manage your subscription to SPSSX-L, send a message to
[hidden email] (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