Several Race Variables to One Race

View: New views
3 Messages — Rating Filter:   Alert me  

Several Race Variables to One Race

by Shannon Deike :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I am creating one variable for race from six variables of race (N=396). I
have the syntax below the data.  The results returned from the Frequency
is Multi Racial = 396. Any feedback will be grateful. Thanks.

Shannon

Native  Asian   Black  Pacific  White  Other
9 9 9 9 1 9
9 9 9 9 1 9
1 9 9 9 9 9
1 9 9 9 9 9
1 9 1 9 9 9
1 9 9 9 9 9
1 9 9 9 9 9
1 9 9 9 9 9
1 9 9 9 9 9
1 9 9 9 9 9


RECODE Q31_Native Q31_Asian Q31_Black Q31_Pacific Q31_White Q31_Other
(1=1) (9 = MISSING) .
EXECUTE.

COMPUTE RACE =  NVALID (Q31_Native, Q31_Asian, Q31_Black, Q31_Pacific,
Q31_White, Q31_Other).

RECODE  RACE (0=0) (1=1) (ELSE=2) .

VARIABLE LABELS RACE 'VALID COUNT OF RACES' .
EXECUTE .

*Compute/Group Single Race Selection Type INTO Race_Single

RECODE  RACE ( 0 = 0 ) ( 2 = 7 ) INTO  Race_Single .
EXECUTE .

DO IF  RACE EQ 1 .
IF ( Q31_Native EQ 1 )  Race_Single = 1 .
IF ( Q31_Asian EQ 1 )  Race_Single = 2 .
IF ( Q31_Black EQ 1 )  Race_Single = 3 .
IF ( Q31_Pacific EQ 1 ) Race_Single = 4 .
IF ( Q31_White EQ 1 )  Race_Single = 5 .
IF ( Q31_Other EQ 1 )  Race_Single = 6 .
END IF .

VALUE LABELS Race_Single 0 'No Response' 1 'Alaska Native/American Indian'
2 'Asian' 3 'African American' 4 'Pacific Islander' 5 'Caucasian'
6 'Other'  7 'Multi Racial'.

=====================
To manage your subscription to SPSSX-L, send a message to
LISTSERV@... (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

Re: Several Race Variables to One Race

by Gene Maguin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Shannon,

I think you made this too complicated. I'm going to assume that your data
are entered exactly as you have illustrated and that the only thing you want
from the data is a single race-ethnic category variable. There are multiple
ways of doing this. I'd do this:


COUNT RACE_SINGLE=Q31_Native, Q31_Asian, Q31_Black, Q31_Pacific,
Q31_White, Q31_Other(1).

RECODE RACE_SINGLE(0=0)(1=1)(2 THRU HI=7).

DO IF  RACE_SINGLE EQ 1.
IF ( Q31_Native EQ 1 )  Race_Single = 1 .
IF ( Q31_Asian EQ 1 )  Race_Single = 2 .
IF ( Q31_Black EQ 1 )  Race_Single = 3 .
IF ( Q31_Pacific EQ 1 ) Race_Single = 4 .
IF ( Q31_White EQ 1 )  Race_Single = 5 .
IF ( Q31_Other EQ 1 )  Race_Single = 6 .
END IF .

VALUE LABELS Race_Single 0 'No Response' 1 'Alaska Native/American Indian'
2 'Asian' 3 'African American' 4 'Pacific Islander' 5 'Caucasian'
6 'Other'  7 'Multi Racial'.

FREQUENCIES RACE_SINGLE.

**********************************************

With respect to your code, the problem is that you should have used

MISSING VALUES Q31_Native Q31_Asian Q31_Black Q31_Pacific Q31_White
Q31_Other(9) .

Instead of

RECODE Q31_Native Q31_Asian Q31_Black Q31_Pacific Q31_White Q31_Other
(1=1) (9 = MISSING).

Actually, you should have gotten an error because 'missing' is not a valid
output keyword for recode. Look at the syntax ref and you'll see.


Gene Maguin


>>I am creating one variable for race from six variables of race (N=396). I
have the syntax below the data.  The results returned from the Frequency
is Multi Racial = 396. Any feedback will be grateful. Thanks.

Shannon

Native  Asian   Black  Pacific  White  Other
9 9 9 9 1 9
9 9 9 9 1 9
1 9 9 9 9 9
1 9 9 9 9 9
1 9 1 9 9 9
1 9 9 9 9 9
1 9 9 9 9 9
1 9 9 9 9 9
1 9 9 9 9 9
1 9 9 9 9 9


RECODE Q31_Native Q31_Asian Q31_Black Q31_Pacific Q31_White Q31_Other
(1=1) (9 = MISSING) .
EXECUTE.

COMPUTE RACE =  NVALID (Q31_Native, Q31_Asian, Q31_Black, Q31_Pacific,
Q31_White, Q31_Other).

RECODE  RACE (0=0) (1=1) (ELSE=2) .

VARIABLE LABELS RACE 'VALID COUNT OF RACES' .
EXECUTE .

*Compute/Group Single Race Selection Type INTO Race_Single

RECODE  RACE ( 0 = 0 ) ( 2 = 7 ) INTO  Race_Single .
EXECUTE .

DO IF  RACE EQ 1 .
IF ( Q31_Native EQ 1 )  Race_Single = 1 .
IF ( Q31_Asian EQ 1 )  Race_Single = 2 .
IF ( Q31_Black EQ 1 )  Race_Single = 3 .
IF ( Q31_Pacific EQ 1 ) Race_Single = 4 .
IF ( Q31_White EQ 1 )  Race_Single = 5 .
IF ( Q31_Other EQ 1 )  Race_Single = 6 .
END IF .

VALUE LABELS Race_Single 0 'No Response' 1 'Alaska Native/American Indian'
2 'Asian' 3 'African American' 4 'Pacific Islander' 5 'Caucasian'
6 'Other'  7 'Multi Racial'.

=====================
To manage your subscription to SPSSX-L, send a message to
LISTSERV@... (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

Re: Several Race Variables to One Race

by Richard Ristow :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

At 03:15 PM 10/28/2009, Shannon Deike wrote:

>I am creating one variable for race from six variables of race (N=396). I
>have the syntax below the data.

With thanks to Gene Maguin for his clear response, I add that the
code you posted has three EXECUTE statements. None of them is needed,
and each of them causes your data to be re-read in its entirety. On a
big file, that can be quite a slow-down.

-Onward, back to the old hobby horse,
  Richard

=====================
To manage your subscription to SPSSX-L, send a message to
LISTSERV@... (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