Hi all,
I suspect this is easy for one or more of you. I have 2 fields for race/ethnicity in a file.
Field 1=Race1: makes people select from only 1 of 9 different races. Hispanic is not an option.
Field 2=Race_Hispanic: makes people select whether or not they are hispanic (1=yes 0=no)
I created a new variable called allrace. Here is what i want to do:
If Race1=white and Race_Hispanic = Yes, then Allrace=Hispanic
If Race1=any other race except for white and Race_hispanic =yes, then Allrace=Race1
If Race_Hispanic =no, Allrace =Race1
My syntax and it runs just fine. But, i'm screwing something up because my I am ending up with the total number of people in my Race_Hispanic=Yes field.
Thanks for any syntax of wisdom.
Carol
|
Carol,
It would help if you would post the actual syntax that you are using. Joe ________________________________________ From: SPSSX(r) Discussion [[hidden email]] On Behalf Of Parise, Carol A. [[hidden email]] Sent: Thursday, January 05, 2012 6:53 PM To: [hidden email] Subject: compute new race variable from 2 fields Hi all, I suspect this is easy for one or more of you. I have 2 fields for race/ethnicity in a file. Field 1=Race1: makes people select from only 1 of 9 different races. Hispanic is not an option. Field 2=Race_Hispanic: makes people select whether or not they are hispanic (1=yes 0=no) I created a new variable called allrace. Here is what i want to do: If Race1=white and Race_Hispanic = Yes, then Allrace=Hispanic If Race1=any other race except for white and Race_hispanic =yes, then Allrace=Race1 If Race_Hispanic =no, Allrace =Race1 My syntax and it runs just fine. But, i'm screwing something up because my I am ending up with the total number of people in my Race_Hispanic=Yes field. Thanks for any syntax of wisdom. Carol ===================== 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 |
In reply to this post by parisec
Carol, It looks like this if I can assume that white means Race1 eq 1 , and that you want to create two groups in allrace (1 = Non Hispanic White; 10 = Hispanic White) . If ( Race1 eq 1 ) and (Race_Hispanic eq 1 ) allrace = 10 . If ( Race1 eq 1 ) and (Race_Hispanic eq 0 ) allrace = 1 . If ( Race1 gt 1 ) allrace = Race1 . It does not appear that you are changing the coding of race for non-white subjects based on whether or not they are Hispanic. Best, Stephen Brand www.StatisticsDoc.com From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Parise, Carol A. Hi all, I suspect this is easy for one or more of you. I have 2 fields for race/ethnicity in a file. Field 1=Race1: makes people select from only 1 of 9 different races. Hispanic is not an option. Field 2=Race_Hispanic: makes people select whether or not they are hispanic (1=yes 0=no) I created a new variable called allrace. Here is what i want to do: If Race1=white and Race_Hispanic = Yes, then Allrace=Hispanic If Race1=any other race except for white and Race_hispanic =yes, then Allrace=Race1 If Race_Hispanic =no, Allrace =Race1 My syntax and it runs just fine. But, i'm screwing something up because my I am ending up with the total number of people in my Race_Hispanic=Yes field. Thanks for any syntax of wisdom. Carol |
In reply to this post by Joseph Willey
here you go!
the end result gives me the correct number of hispanics and whites. but then it gives me the number of people of other races who stated that they are hispanic. compute AllRace=$sysmis. if (race1=0 and race_hispanic=0) allrace=0. if (race1=0 and race_hispanic=1) allrace=2. if (race1 ge 1 and race_hispanic=1) allrace=race_comb. value labels allrace 0 'white' 1 'black' 2 'hispanic' 3 'pacific islander' 4 'se asian' 5 'indian continent' 6 'american indian' 7 'chinese' 8 'japanese' 9 'philipino' 10 'korean' 99 'other-unknown'. -----Original Message----- From: Joseph Willey [mailto:[hidden email]] Sent: Thursday, January 05, 2012 4:02 PM To: Parise, Carol A.; [hidden email] Subject: RE: compute new race variable from 2 fields Carol, It would help if you would post the actual syntax that you are using. Joe ________________________________________ From: SPSSX(r) Discussion [[hidden email]] On Behalf Of Parise, Carol A. [[hidden email]] Sent: Thursday, January 05, 2012 6:53 PM To: [hidden email] Subject: compute new race variable from 2 fields Hi all, I suspect this is easy for one or more of you. I have 2 fields for race/ethnicity in a file. Field 1=Race1: makes people select from only 1 of 9 different races. Hispanic is not an option. Field 2=Race_Hispanic: makes people select whether or not they are hispanic (1=yes 0=no) I created a new variable called allrace. Here is what i want to do: If Race1=white and Race_Hispanic = Yes, then Allrace=Hispanic If Race1=any other race except for white and Race_hispanic =yes, then Allrace=Race1 If Race_Hispanic =no, Allrace =Race1 My syntax and it runs just fine. But, i'm screwing something up because my I am ending up with the total number of people in my Race_Hispanic=Yes field. Thanks for any syntax of wisdom. Carol ===================== 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 |
Carol,
What is race_comb and how was it computed? Best, Steve www.StatisticsDoc.com -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Parise, Carol A. Sent: Thursday, January 05, 2012 7:16 PM To: [hidden email] Subject: Re: compute new race variable from 2 fields here you go! the end result gives me the correct number of hispanics and whites. but then it gives me the number of people of other races who stated that they are hispanic. compute AllRace=$sysmis. if (race1=0 and race_hispanic=0) allrace=0. if (race1=0 and race_hispanic=1) allrace=2. if (race1 ge 1 and race_hispanic=1) allrace=race_comb. value labels allrace 0 'white' 1 'black' 2 'hispanic' 3 'pacific islander' 4 'se asian' 5 'indian continent' 6 'american indian' 7 'chinese' 8 'japanese' 9 'philipino' 10 'korean' 99 'other-unknown'. -----Original Message----- From: Joseph Willey [mailto:[hidden email]] Sent: Thursday, January 05, 2012 4:02 PM To: Parise, Carol A.; [hidden email] Subject: RE: compute new race variable from 2 fields Carol, It would help if you would post the actual syntax that you are using. Joe ________________________________________ From: SPSSX(r) Discussion [[hidden email]] On Behalf Of Parise, Carol A. [[hidden email]] Sent: Thursday, January 05, 2012 6:53 PM To: [hidden email] Subject: compute new race variable from 2 fields Hi all, I suspect this is easy for one or more of you. I have 2 fields for race/ethnicity in a file. Field 1=Race1: makes people select from only 1 of 9 different races. Hispanic is not an option. Field 2=Race_Hispanic: makes people select whether or not they are hispanic (1=yes 0=no) I created a new variable called allrace. Here is what i want to do: If Race1=white and Race_Hispanic = Yes, then Allrace=Hispanic If Race1=any other race except for white and Race_hispanic =yes, then Allrace=Race1 If Race_Hispanic =no, Allrace =Race1 My syntax and it runs just fine. But, i'm screwing something up because my I am ending up with the total number of people in my Race_Hispanic=Yes field. Thanks for any syntax of wisdom. Carol ===================== 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 |
Ahh...my error in my posting. race_comb should be RACE1. for this post, i change the name race_comb to RACE1 for simplicity.
this is the corrected syntax: compute AllRace=$sysmis. if (race1=0 and race_hispanic=0) allrace=0. if (race1=0 and race_hispanic=1) allrace=2. if (race1 ge 1 and race_hispanic=1) allrace=race1. value labels allrace 0 'white' 1 'black' 2 'hispanic' 3 'pacific islander' 4 'se asian' 5 'indian continent' 6 'american indian' 7 'chinese' 8 'japanese' 9 'philipino' 10 'korean' 99 'other-unknown'. -----Original Message----- From: StatisticsDoc [mailto:[hidden email]] Sent: Thursday, January 05, 2012 4:32 PM To: Parise, Carol A.; [hidden email] Subject: RE: compute new race variable from 2 fields Carol, What is race_comb and how was it computed? Best, Steve www.StatisticsDoc.com -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Parise, Carol A. Sent: Thursday, January 05, 2012 7:16 PM To: [hidden email] Subject: Re: compute new race variable from 2 fields here you go! the end result gives me the correct number of hispanics and whites. but then it gives me the number of people of other races who stated that they are hispanic. compute AllRace=$sysmis. if (race1=0 and race_hispanic=0) allrace=0. if (race1=0 and race_hispanic=1) allrace=2. if (race1 ge 1 and race_hispanic=1) allrace=race_comb. value labels allrace 0 'white' 1 'black' 2 'hispanic' 3 'pacific islander' 4 'se asian' 5 'indian continent' 6 'american indian' 7 'chinese' 8 'japanese' 9 'philipino' 10 'korean' 99 'other-unknown'. -----Original Message----- From: Joseph Willey [mailto:[hidden email]] Sent: Thursday, January 05, 2012 4:02 PM To: Parise, Carol A.; [hidden email] Subject: RE: compute new race variable from 2 fields Carol, It would help if you would post the actual syntax that you are using. Joe ________________________________________ From: SPSSX(r) Discussion [[hidden email]] On Behalf Of Parise, Carol A. [[hidden email]] Sent: Thursday, January 05, 2012 6:53 PM To: [hidden email] Subject: compute new race variable from 2 fields Hi all, I suspect this is easy for one or more of you. I have 2 fields for race/ethnicity in a file. Field 1=Race1: makes people select from only 1 of 9 different races. Hispanic is not an option. Field 2=Race_Hispanic: makes people select whether or not they are hispanic (1=yes 0=no) I created a new variable called allrace. Here is what i want to do: If Race1=white and Race_Hispanic = Yes, then Allrace=Hispanic If Race1=any other race except for white and Race_hispanic =yes, then Allrace=Race1 If Race_Hispanic =no, Allrace =Race1 My syntax and it runs just fine. But, i'm screwing something up because my I am ending up with the total number of people in my Race_Hispanic=Yes field. Thanks for any syntax of wisdom. Carol ===================== 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 |
Even still, all of the people who are not white and not hispanic are sysmis.
Change if (race1 ge 1 and race_hispanic=1) allrace=race_comb. to --> IF (race1 GE 1) allrace=race1. Joe ________________________________________ From: SPSSX(r) Discussion [[hidden email]] On Behalf Of Parise, Carol A. [[hidden email]] Sent: Thursday, January 05, 2012 7:37 PM To: [hidden email] Subject: Re: compute new race variable from 2 fields Ahh...my error in my posting. race_comb should be RACE1. for this post, i change the name race_comb to RACE1 for simplicity. this is the corrected syntax: compute AllRace=$sysmis. if (race1=0 and race_hispanic=0) allrace=0. if (race1=0 and race_hispanic=1) allrace=2. if (race1 ge 1 and race_hispanic=1) allrace=race1. value labels allrace 0 'white' 1 'black' 2 'hispanic' 3 'pacific islander' 4 'se asian' 5 'indian continent' 6 'american indian' 7 'chinese' 8 'japanese' 9 'philipino' 10 'korean' 99 'other-unknown'. -----Original Message----- From: StatisticsDoc [mailto:[hidden email]] Sent: Thursday, January 05, 2012 4:32 PM To: Parise, Carol A.; [hidden email] Subject: RE: compute new race variable from 2 fields Carol, What is race_comb and how was it computed? Best, Steve www.StatisticsDoc.com -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Parise, Carol A. Sent: Thursday, January 05, 2012 7:16 PM To: [hidden email] Subject: Re: compute new race variable from 2 fields here you go! the end result gives me the correct number of hispanics and whites. but then it gives me the number of people of other races who stated that they are hispanic. compute AllRace=$sysmis. if (race1=0 and race_hispanic=0) allrace=0. if (race1=0 and race_hispanic=1) allrace=2. if (race1 ge 1 and race_hispanic=1) allrace=race_comb. value labels allrace 0 'white' 1 'black' 2 'hispanic' 3 'pacific islander' 4 'se asian' 5 'indian continent' 6 'american indian' 7 'chinese' 8 'japanese' 9 'philipino' 10 'korean' 99 'other-unknown'. -----Original Message----- From: Joseph Willey [mailto:[hidden email]] Sent: Thursday, January 05, 2012 4:02 PM To: Parise, Carol A.; [hidden email] Subject: RE: compute new race variable from 2 fields Carol, It would help if you would post the actual syntax that you are using. Joe ________________________________________ From: SPSSX(r) Discussion [[hidden email]] On Behalf Of Parise, Carol A. [[hidden email]] Sent: Thursday, January 05, 2012 6:53 PM To: [hidden email] Subject: compute new race variable from 2 fields Hi all, I suspect this is easy for one or more of you. I have 2 fields for race/ethnicity in a file. Field 1=Race1: makes people select from only 1 of 9 different races. Hispanic is not an option. Field 2=Race_Hispanic: makes people select whether or not they are hispanic (1=yes 0=no) I created a new variable called allrace. Here is what i want to do: If Race1=white and Race_Hispanic = Yes, then Allrace=Hispanic If Race1=any other race except for white and Race_hispanic =yes, then Allrace=Race1 If Race_Hispanic =no, Allrace =Race1 My syntax and it runs just fine. But, i'm screwing something up because my I am ending up with the total number of people in my Race_Hispanic=Yes field. Thanks for any syntax of wisdom. Carol ===================== 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 ===================== 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 |
In reply to this post by parisec
Carol,
What appears to be missing is the line: if (race1 ge 1 and race_hispanic=0) allrace=race1. Without this line, all of the non-white non-hispanics are missing on allrace. Once you add this line, it becomes clear that the two statements: if (race1 ge 1 and race_hispanic=1) allrace=race1. if (race1 ge 1 and race_hispanic=0) allrace=race1. Can be simplified to this one statement: if (race1 ge 1) allrace=race1. With the added advantage of computing allrace for non-white cases who had missing data on race_hispanic . Best, Steve www.StatisticsDoc.com -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Parise, Carol A. Sent: Thursday, January 05, 2012 7:38 PM To: [hidden email] Subject: Re: compute new race variable from 2 fields Ahh...my error in my posting. race_comb should be RACE1. for this post, i change the name race_comb to RACE1 for simplicity. this is the corrected syntax: compute AllRace=$sysmis. if (race1=0 and race_hispanic=0) allrace=0. if (race1=0 and race_hispanic=1) allrace=2. if (race1 ge 1 and race_hispanic=1) allrace=race1. value labels allrace 0 'white' 1 'black' 2 'hispanic' 3 'pacific islander' 4 'se asian' 5 'indian continent' 6 'american indian' 7 'chinese' 8 'japanese' 9 'philipino' 10 'korean' 99 'other-unknown'. -----Original Message----- From: StatisticsDoc [mailto:[hidden email]] Sent: Thursday, January 05, 2012 4:32 PM To: Parise, Carol A.; [hidden email] Subject: RE: compute new race variable from 2 fields Carol, What is race_comb and how was it computed? Best, Steve www.StatisticsDoc.com -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Parise, Carol A. Sent: Thursday, January 05, 2012 7:16 PM To: [hidden email] Subject: Re: compute new race variable from 2 fields here you go! the end result gives me the correct number of hispanics and whites. but then it gives me the number of people of other races who stated that they are hispanic. compute AllRace=$sysmis. if (race1=0 and race_hispanic=0) allrace=0. if (race1=0 and race_hispanic=1) allrace=2. if (race1 ge 1 and race_hispanic=1) allrace=race_comb. value labels allrace 0 'white' 1 'black' 2 'hispanic' 3 'pacific islander' 4 'se asian' 5 'indian continent' 6 'american indian' 7 'chinese' 8 'japanese' 9 'philipino' 10 'korean' 99 'other-unknown'. -----Original Message----- From: Joseph Willey [mailto:[hidden email]] Sent: Thursday, January 05, 2012 4:02 PM To: Parise, Carol A.; [hidden email] Subject: RE: compute new race variable from 2 fields Carol, It would help if you would post the actual syntax that you are using. Joe ________________________________________ From: SPSSX(r) Discussion [[hidden email]] On Behalf Of Parise, Carol A. [[hidden email]] Sent: Thursday, January 05, 2012 6:53 PM To: [hidden email] Subject: compute new race variable from 2 fields Hi all, I suspect this is easy for one or more of you. I have 2 fields for race/ethnicity in a file. Field 1=Race1: makes people select from only 1 of 9 different races. Hispanic is not an option. Field 2=Race_Hispanic: makes people select whether or not they are hispanic (1=yes 0=no) I created a new variable called allrace. Here is what i want to do: If Race1=white and Race_Hispanic = Yes, then Allrace=Hispanic If Race1=any other race except for white and Race_hispanic =yes, then Allrace=Race1 If Race_Hispanic =no, Allrace =Race1 My syntax and it runs just fine. But, i'm screwing something up because my I am ending up with the total number of people in my Race_Hispanic=Yes field. Thanks for any syntax of wisdom. Carol ===================== 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 ===================== 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 |
In reply to this post by Joseph Willey
This works and computes the correct number of hispanics and whites but it counts people who are state that they are any other race and hispanic twice.
For example: for Race1 = Black has n=12317 using crosstabs, i learned that 235 people who are black, also checked Yes for Race_Hispanic. allrace computes black as 12317+235 = 12552 what i need is to have those 235 people not be included in the allrace field. make sense? -----Original Message----- From: Joseph Willey [mailto:[hidden email]] Sent: Thursday, January 05, 2012 4:46 PM To: Parise, Carol A.; [hidden email] Subject: RE: compute new race variable from 2 fields Even still, all of the people who are not white and not hispanic are sysmis. Change if (race1 ge 1 and race_hispanic=1) allrace=race_comb. to --> IF (race1 GE 1) allrace=race1. Joe ________________________________________ From: SPSSX(r) Discussion [[hidden email]] On Behalf Of Parise, Carol A. [[hidden email]] Sent: Thursday, January 05, 2012 7:37 PM To: [hidden email] Subject: Re: compute new race variable from 2 fields Ahh...my error in my posting. race_comb should be RACE1. for this post, i change the name race_comb to RACE1 for simplicity. this is the corrected syntax: compute AllRace=$sysmis. if (race1=0 and race_hispanic=0) allrace=0. if (race1=0 and race_hispanic=1) allrace=2. if (race1 ge 1 and race_hispanic=1) allrace=race1. value labels allrace 0 'white' 1 'black' 2 'hispanic' 3 'pacific islander' 4 'se asian' 5 'indian continent' 6 'american indian' 7 'chinese' 8 'japanese' 9 'philipino' 10 'korean' 99 'other-unknown'. -----Original Message----- From: StatisticsDoc [mailto:[hidden email]] Sent: Thursday, January 05, 2012 4:32 PM To: Parise, Carol A.; [hidden email] Subject: RE: compute new race variable from 2 fields Carol, What is race_comb and how was it computed? Best, Steve www.StatisticsDoc.com -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Parise, Carol A. Sent: Thursday, January 05, 2012 7:16 PM To: [hidden email] Subject: Re: compute new race variable from 2 fields here you go! the end result gives me the correct number of hispanics and whites. but then it gives me the number of people of other races who stated that they are hispanic. compute AllRace=$sysmis. if (race1=0 and race_hispanic=0) allrace=0. if (race1=0 and race_hispanic=1) allrace=2. if (race1 ge 1 and race_hispanic=1) allrace=race_comb. value labels allrace 0 'white' 1 'black' 2 'hispanic' 3 'pacific islander' 4 'se asian' 5 'indian continent' 6 'american indian' 7 'chinese' 8 'japanese' 9 'philipino' 10 'korean' 99 'other-unknown'. -----Original Message----- From: Joseph Willey [mailto:[hidden email]] Sent: Thursday, January 05, 2012 4:02 PM To: Parise, Carol A.; [hidden email] Subject: RE: compute new race variable from 2 fields Carol, It would help if you would post the actual syntax that you are using. Joe ________________________________________ From: SPSSX(r) Discussion [[hidden email]] On Behalf Of Parise, Carol A. [[hidden email]] Sent: Thursday, January 05, 2012 6:53 PM To: [hidden email] Subject: compute new race variable from 2 fields Hi all, I suspect this is easy for one or more of you. I have 2 fields for race/ethnicity in a file. Field 1=Race1: makes people select from only 1 of 9 different races. Hispanic is not an option. Field 2=Race_Hispanic: makes people select whether or not they are hispanic (1=yes 0=no) I created a new variable called allrace. Here is what i want to do: If Race1=white and Race_Hispanic = Yes, then Allrace=Hispanic If Race1=any other race except for white and Race_hispanic =yes, then Allrace=Race1 If Race_Hispanic =no, Allrace =Race1 My syntax and it runs just fine. But, i'm screwing something up because my I am ending up with the total number of people in my Race_Hispanic=Yes field. Thanks for any syntax of wisdom. Carol ===================== 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 ===================== 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 |
Not what you originally said "If Race1=white and Race_Hispanic = Yes, then Allrace=Hispanic If Race1=any other race except for white and Race_hispanic =yes, then Allrace=Race1 If Race_Hispanic =no, Allrace =Race1"
Think through it. Do your own work. ________________________________________ From: Parise, Carol A. [[hidden email]] Sent: Thursday, January 05, 2012 7:54 PM To: Joseph Willey; [hidden email] Subject: RE: compute new race variable from 2 fields This works and computes the correct number of hispanics and whites but it counts people who are state that they are any other race and hispanic twice. For example: for Race1 = Black has n=12317 using crosstabs, i learned that 235 people who are black, also checked Yes for Race_Hispanic. allrace computes black as 12317+235 = 12552 what i need is to have those 235 people not be included in the allrace field. make sense? -----Original Message----- From: Joseph Willey [mailto:[hidden email]] Sent: Thursday, January 05, 2012 4:46 PM To: Parise, Carol A.; [hidden email] Subject: RE: compute new race variable from 2 fields Even still, all of the people who are not white and not hispanic are sysmis. Change if (race1 ge 1 and race_hispanic=1) allrace=race_comb. to --> IF (race1 GE 1) allrace=race1. Joe ________________________________________ From: SPSSX(r) Discussion [[hidden email]] On Behalf Of Parise, Carol A. [[hidden email]] Sent: Thursday, January 05, 2012 7:37 PM To: [hidden email] Subject: Re: compute new race variable from 2 fields Ahh...my error in my posting. race_comb should be RACE1. for this post, i change the name race_comb to RACE1 for simplicity. this is the corrected syntax: compute AllRace=$sysmis. if (race1=0 and race_hispanic=0) allrace=0. if (race1=0 and race_hispanic=1) allrace=2. if (race1 ge 1 and race_hispanic=1) allrace=race1. value labels allrace 0 'white' 1 'black' 2 'hispanic' 3 'pacific islander' 4 'se asian' 5 'indian continent' 6 'american indian' 7 'chinese' 8 'japanese' 9 'philipino' 10 'korean' 99 'other-unknown'. -----Original Message----- From: StatisticsDoc [mailto:[hidden email]] Sent: Thursday, January 05, 2012 4:32 PM To: Parise, Carol A.; [hidden email] Subject: RE: compute new race variable from 2 fields Carol, What is race_comb and how was it computed? Best, Steve www.StatisticsDoc.com -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Parise, Carol A. Sent: Thursday, January 05, 2012 7:16 PM To: [hidden email] Subject: Re: compute new race variable from 2 fields here you go! the end result gives me the correct number of hispanics and whites. but then it gives me the number of people of other races who stated that they are hispanic. compute AllRace=$sysmis. if (race1=0 and race_hispanic=0) allrace=0. if (race1=0 and race_hispanic=1) allrace=2. if (race1 ge 1 and race_hispanic=1) allrace=race_comb. value labels allrace 0 'white' 1 'black' 2 'hispanic' 3 'pacific islander' 4 'se asian' 5 'indian continent' 6 'american indian' 7 'chinese' 8 'japanese' 9 'philipino' 10 'korean' 99 'other-unknown'. -----Original Message----- From: Joseph Willey [mailto:[hidden email]] Sent: Thursday, January 05, 2012 4:02 PM To: Parise, Carol A.; [hidden email] Subject: RE: compute new race variable from 2 fields Carol, It would help if you would post the actual syntax that you are using. Joe ________________________________________ From: SPSSX(r) Discussion [[hidden email]] On Behalf Of Parise, Carol A. [[hidden email]] Sent: Thursday, January 05, 2012 6:53 PM To: [hidden email] Subject: compute new race variable from 2 fields Hi all, I suspect this is easy for one or more of you. I have 2 fields for race/ethnicity in a file. Field 1=Race1: makes people select from only 1 of 9 different races. Hispanic is not an option. Field 2=Race_Hispanic: makes people select whether or not they are hispanic (1=yes 0=no) I created a new variable called allrace. Here is what i want to do: If Race1=white and Race_Hispanic = Yes, then Allrace=Hispanic If Race1=any other race except for white and Race_hispanic =yes, then Allrace=Race1 If Race_Hispanic =no, Allrace =Race1 My syntax and it runs just fine. But, i'm screwing something up because my I am ending up with the total number of people in my Race_Hispanic=Yes field. Thanks for any syntax of wisdom. Carol ===================== 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 ===================== 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 |
Have you thought about an intermediate step to combine the two variables.
You have 2 variables: Race1 has codes 1 thru 9. Race-hispanic has codes 0 and 1. Looks as if you might have used 99 for missing. I've often used the following trick. compute allrace = race_hispanic*100 + race1 . freq allrace. recode allrace (.........) [into allrace2] val lab allrace2 ..... on the combinations to produce a tidier grouping. If you called your variables v1 and v2 or q1 and q2 etc., you would save yourself a lot of typing and avoid RSI! John Hall Email: [hidden email] Website: www.surveyresearch.weebly.com Skype: surveyresearcher1 Phone: (+33) (0) 2.33.45.91.47 -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Joseph Willey Sent: 06 January 2012 01:58 To: [hidden email] Subject: Re: compute new race variable from 2 fields Not what you originally said "If Race1=white and Race_Hispanic = Yes, then Allrace=Hispanic If Race1=any other race except for white and Race_hispanic =yes, then Allrace=Race1 If Race_Hispanic =no, Allrace =Race1" Think through it. Do your own work. ________________________________________ From: Parise, Carol A. [[hidden email]] Sent: Thursday, January 05, 2012 7:54 PM To: Joseph Willey; [hidden email] Subject: RE: compute new race variable from 2 fields This works and computes the correct number of hispanics and whites but it counts people who are state that they are any other race and hispanic twice. For example: for Race1 = Black has n=12317 using crosstabs, i learned that 235 people who are black, also checked Yes for Race_Hispanic. allrace computes black as 12317+235 = 12552 what i need is to have those 235 people not be included in the allrace field. make sense? -----Original Message----- From: Joseph Willey [mailto:[hidden email]] Sent: Thursday, January 05, 2012 4:46 PM To: Parise, Carol A.; [hidden email] Subject: RE: compute new race variable from 2 fields Even still, all of the people who are not white and not hispanic are sysmis. Change if (race1 ge 1 and race_hispanic=1) allrace=race_comb. to --> IF (race1 GE 1) allrace=race1. Joe ________________________________________ From: SPSSX(r) Discussion [[hidden email]] On Behalf Of Parise, Carol A. [[hidden email]] Sent: Thursday, January 05, 2012 7:37 PM To: [hidden email] Subject: Re: compute new race variable from 2 fields Ahh...my error in my posting. race_comb should be RACE1. for this post, i change the name race_comb to RACE1 for simplicity. this is the corrected syntax: compute AllRace=$sysmis. if (race1=0 and race_hispanic=0) allrace=0. if (race1=0 and race_hispanic=1) allrace=2. if (race1 ge 1 and race_hispanic=1) allrace=race1. value labels allrace 0 'white' 1 'black' 2 'hispanic' 3 'pacific islander' 4 'se asian' 5 'indian continent' 6 'american indian' 7 'chinese' 8 'japanese' 9 'philipino' 10 'korean' 99 'other-unknown'. -----Original Message----- From: StatisticsDoc [mailto:[hidden email]] Sent: Thursday, January 05, 2012 4:32 PM To: Parise, Carol A.; [hidden email] Subject: RE: compute new race variable from 2 fields Carol, What is race_comb and how was it computed? Best, Steve www.StatisticsDoc.com -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Parise, Carol A. Sent: Thursday, January 05, 2012 7:16 PM To: [hidden email] Subject: Re: compute new race variable from 2 fields here you go! the end result gives me the correct number of hispanics and whites. but then it gives me the number of people of other races who stated that they are hispanic. compute AllRace=$sysmis. if (race1=0 and race_hispanic=0) allrace=0. if (race1=0 and race_hispanic=1) allrace=2. if (race1 ge 1 and race_hispanic=1) allrace=race_comb. value labels allrace 0 'white' 1 'black' 2 'hispanic' 3 'pacific islander' 4 'se asian' 5 'indian continent' 6 'american indian' 7 'chinese' 8 'japanese' 9 'philipino' 10 'korean' 99 'other-unknown'. -----Original Message----- From: Joseph Willey [mailto:[hidden email]] Sent: Thursday, January 05, 2012 4:02 PM To: Parise, Carol A.; [hidden email] Subject: RE: compute new race variable from 2 fields Carol, It would help if you would post the actual syntax that you are using. Joe ________________________________________ From: SPSSX(r) Discussion [[hidden email]] On Behalf Of Parise, Carol A. [[hidden email]] Sent: Thursday, January 05, 2012 6:53 PM To: [hidden email] Subject: compute new race variable from 2 fields Hi all, I suspect this is easy for one or more of you. I have 2 fields for race/ethnicity in a file. Field 1=Race1: makes people select from only 1 of 9 different races. Hispanic is not an option. Field 2=Race_Hispanic: makes people select whether or not they are hispanic (1=yes 0=no) I created a new variable called allrace. Here is what i want to do: If Race1=white and Race_Hispanic = Yes, then Allrace=Hispanic If Race1=any other race except for white and Race_hispanic =yes, then Allrace=Race1 If Race_Hispanic =no, Allrace =Race1 My syntax and it runs just fine. But, i'm screwing something up because my I am ending up with the total number of people in my Race_Hispanic=Yes field. Thanks for any syntax of wisdom. Carol ===================== 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 ===================== 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 |
In reply to this post by parisec
Hi,
test string allrace(a15). compute allrace=race1. if (race1=white and race_his=yes) allrace=hispanic. exe. |
Administrator
|
In reply to this post by parisec
Please post your current syntax and a crosstab of hispanic (columns) and race1 (rows).
Are there any missing values? Given your recent syntax. What happens to people who have value 2 on race1? They get counted as Hispanic. --
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me. --- "Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis." Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?" |
Thanks.
The following syntax produces the table below
compute AllRace=$sysmis.
if (race1=0 and race_hispanic=0) allrace=0.
if (race1=0 and race_hispanic=1) allrace=2.
if (race1 ge 1) ) allrace=race1.
Here is the result of the crosstabs between the 2 variables
This is what I'd like the Allrace field to compute to. If they state that they are hispanic in addition to any other race, we want to pick up the 'any other race' versus the hispanic.
-----Original Message-----
From: SPSSX(r) Discussion [[hidden email]] On Behalf Of David Marso
Sent: Friday, January 06, 2012 7:21 AM
To: [hidden email]
Subject: Re: compute new race variable from 2 fields
Please post your current syntax and a crosstab of hispanic (columns) and
race1 (rows).
Are there any missing values?
Given your recent syntax.
What happens to people who have value 2 on race1? They get counted as Hispanic.
--
parisec wrote
>
> Hi all,
>
> I suspect this is easy for one or more of you. I have 2 fields for
> race/ethnicity in a file.
>
> Field 1=Race1: makes people select from only 1 of 9 different races.
> Hispanic is not an option.
> Field 2=Race_Hispanic: makes people select whether or not they are
> hispanic (1=yes 0=no)
>
> I created a new variable called allrace. Here is what i want to do:
>
> If Race1=white and Race_Hispanic = Yes, then Allrace=Hispanic If
> Race1=any other race except for white and Race_hispanic =yes, then
> Allrace=Race1
> If Race_Hispanic =no, Allrace =Race1
>
> My syntax and it runs just fine. But, i'm screwing something up
> because my I am ending up with the total number of people in my
> Race_Hispanic=Yes field.
>
> Thanks for any syntax of wisdom.
>
> Carol
>
--
View this message in context: http://spssx-discussion.1045642.n5.nabble.com/compute-new-race-variable-from-2-fields-tp5124256p5125807.html
Sent from the SPSSX Discussion mailing list archive at Nabble.com.
=====================
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
|
In reply to this post by John F Hall
Holy %^&* - this worked so fast and easy!
Since i posted the table of the semi-working syntax...Here is the result of:
compute allrace = race_hispanic*100 + race1 .
freq allrace.
All i need to do now is recode 100 to be hispanic and ge 101 as "multiple".
Thanks a bunch for your help!
Carol
-----Original Message-----
From: John F Hall [[hidden email]]
Sent: Thursday, January 05, 2012 10:56 PM
To: [hidden email]; Parise, Carol A.
Subject: RE: compute new race variable from 2 fields
Have you thought about an intermediate step to combine the two variables.
You have 2 variables:
Race1 has codes 1 thru 9.
Race-hispanic has codes 0 and 1.
Looks as if you might have used 99 for missing.
I've often used the following trick.
compute allrace = race_hispanic*100 + race1 .
freq allrace.
recode allrace (.........) [into allrace2] val lab allrace2 .....
on the combinations to produce a tidier grouping.
If you called your variables v1 and v2 or q1 and q2 etc., you would save yourself a lot of typing and avoid RSI!
John Hall
Email: [hidden email]
Website: www.surveyresearch.weebly.com
Skype: surveyresearcher1
Phone: (+33) (0) 2.33.45.91.47
-----Original Message-----
From: SPSSX(r) Discussion [[hidden email]] On Behalf Of Joseph Willey
Sent: 06 January 2012 01:58
To: [hidden email]
Subject: Re: compute new race variable from 2 fields
Not what you originally said "If Race1=white and Race_Hispanic = Yes, then Allrace=Hispanic If Race1=any other race except for white and Race_hispanic =yes, then Allrace=Race1 If Race_Hispanic =no, Allrace =Race1"
Think through it. Do your own work.
________________________________________
From: Parise, Carol A. [[hidden email]]
Sent: Thursday, January 05, 2012 7:54 PM
To: Joseph Willey; [hidden email]
Subject: RE: compute new race variable from 2 fields
This works and computes the correct number of hispanics and whites but it counts people who are state that they are any other race and hispanic twice.
For example:
for Race1 = Black has n=12317
using crosstabs, i learned that 235 people who are black, also checked Yes for Race_Hispanic.
allrace computes black as 12317+235 = 12552
what i need is to have those 235 people not be included in the allrace field.
make sense?
-----Original Message-----
From: Joseph Willey [[hidden email]]
Sent: Thursday, January 05, 2012 4:46 PM
To: Parise, Carol A.; [hidden email]
Subject: RE: compute new race variable from 2 fields
Even still, all of the people who are not white and not hispanic are sysmis.
Change if (race1 ge 1 and race_hispanic=1) allrace=race_comb.
to --> IF (race1 GE 1) allrace=race1.
Joe
________________________________________
From: SPSSX(r) Discussion [[hidden email]] On Behalf Of Parise, Carol A. [[hidden email]]
Sent: Thursday, January 05, 2012 7:37 PM
To: [hidden email]
Subject: Re: compute new race variable from 2 fields
Ahh...my error in my posting. race_comb should be RACE1. for this post, i change the name race_comb to RACE1 for simplicity.
this is the corrected syntax:
compute AllRace=$sysmis.
if (race1=0 and race_hispanic=0) allrace=0.
if (race1=0 and race_hispanic=1) allrace=2.
if (race1 ge 1 and race_hispanic=1) allrace=race1.
value labels allrace 0 'white' 1 'black' 2 'hispanic' 3 'pacific islander' 4 'se asian' 5 'indian continent'
6 'american indian' 7 'chinese' 8 'japanese' 9 'philipino' 10 'korean' 99 'other-unknown'.
-----Original Message-----
From: StatisticsDoc [[hidden email]]
Sent: Thursday, January 05, 2012 4:32 PM
To: Parise, Carol A.; [hidden email]
Subject: RE: compute new race variable from 2 fields
Carol,
What is race_comb and how was it computed?
Best,
Steve
-----Original Message-----
From: SPSSX(r) Discussion [[hidden email]] On Behalf Of Parise, Carol A.
Sent: Thursday, January 05, 2012 7:16 PM
To: [hidden email]
Subject: Re: compute new race variable from 2 fields
here you go!
the end result gives me the correct number of hispanics and whites. but then it gives me the number of people of other races who stated that they are hispanic.
compute AllRace=$sysmis.
if (race1=0 and race_hispanic=0) allrace=0.
if (race1=0 and race_hispanic=1) allrace=2.
if (race1 ge 1 and race_hispanic=1) allrace=race_comb.
value labels allrace 0 'white' 1 'black' 2 'hispanic' 3 'pacific islander' 4 'se asian' 5 'indian continent'
6 'american indian' 7 'chinese' 8 'japanese' 9 'philipino' 10 'korean' 99 'other-unknown'.
-----Original Message-----
From: Joseph Willey [[hidden email]]
Sent: Thursday, January 05, 2012 4:02 PM
To: Parise, Carol A.; [hidden email]
Subject: RE: compute new race variable from 2 fields
Carol,
It would help if you would post the actual syntax that you are using.
Joe
________________________________________
From: SPSSX(r) Discussion [[hidden email]] On Behalf Of Parise, Carol A. [[hidden email]]
Sent: Thursday, January 05, 2012 6:53 PM
To: [hidden email]
Subject: compute new race variable from 2 fields
Hi all,
I suspect this is easy for one or more of you. I have 2 fields for race/ethnicity in a file.
Field 1=Race1: makes people select from only 1 of 9 different races.
Hispanic is not an option.
Field 2=Race_Hispanic: makes people select whether or not they are hispanic (1=yes 0=no)
I created a new variable called allrace. Here is what i want to do:
If Race1=white and Race_Hispanic = Yes, then Allrace=Hispanic If Race1=any other race except for white and Race_hispanic =yes, then Allrace=Race1 If Race_Hispanic =no, Allrace =Race1
My syntax and it runs just fine. But, i'm screwing something up because my I am ending up with the total number of people in my Race_Hispanic=Yes field.
Thanks for any syntax of wisdom.
Carol
=====================
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
=====================
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
|
Glad to be of help. Some of us old dogs, brought up on syntax, know some nice old tricks: also they’re much quicker in syntax than in GUI. See the Old Dog, Old Tricks paper on my website (http://surveyresearch.weebly.com/old-dog-old-tricks.html ) In the old days when computing was so expensive (and slow) COMPUTE and RECODE were always much cheaper and quicker than IF or, worse still, multiple IFs, which pass through the data each time instead of just once. Don’t forget to do crosstab checks on your recoded allrace (INTO allrace2): cro allrace2 by race1 race_hispanic Always best to be sure. John Hall Email: [hidden email] Website: www.surveyresearch.weebly.com Skype: surveyresearcher1 Phone: (+33) (0) 2.33.45.91.47 From: Parise, Carol A. [mailto:[hidden email]] Holy %^&* - this worked so fast and easy! Since i posted the table of the semi-working syntax...Here is the result of: compute allrace = race_hispanic*100 + race1 . freq allrace. All i need to do now is recode 100 to be hispanic and ge 101 as "multiple". Thanks a bunch for your help! Carol
-----Original Message----- From: John F Hall [[hidden email]] Sent: Thursday, January 05, 2012 10:56 PM To: [hidden email]; Parise, Carol A. Subject: RE: compute new race variable from 2 fields Have you thought about an intermediate step to combine the two variables. You have 2 variables: Race1 has codes 1 thru 9. Race-hispanic has codes 0 and 1. Looks as if you might have used 99 for missing. I've often used the following trick. compute allrace = race_hispanic*100 + race1 . freq allrace. recode allrace (.........) [into allrace2] val lab allrace2 ..... on the combinations to produce a tidier grouping. If you called your variables v1 and v2 or q1 and q2 etc., you would save yourself a lot of typing and avoid RSI! John Hall Email: [hidden email] Website: www.surveyresearch.weebly.com Skype: surveyresearcher1 Phone: (+33) (0) 2.33.45.91.47 -----Original Message----- From: SPSSX(r) Discussion [[hidden email]] On Behalf Of Joseph Willey Sent: 06 January 2012 01:58 To: [hidden email] Subject: Re: compute new race variable from 2 fields Not what you originally said "If Race1=white and Race_Hispanic = Yes, then Allrace=Hispanic If Race1=any other race except for white and Race_hispanic =yes, then Allrace=Race1 If Race_Hispanic =no, Allrace =Race1" Think through it. Do your own work. ________________________________________ From: Parise, Carol A. [[hidden email]] Sent: Thursday, January 05, 2012 7:54 PM To: Joseph Willey; [hidden email] Subject: RE: compute new race variable from 2 fields This works and computes the correct number of hispanics and whites but it counts people who are state that they are any other race and hispanic twice. For example: for Race1 = Black has n=12317 using crosstabs, i learned that 235 people who are black, also checked Yes for Race_Hispanic. allrace computes black as 12317+235 = 12552 what i need is to have those 235 people not be included in the allrace field. make sense? -----Original Message----- From: Joseph Willey [[hidden email]] Sent: Thursday, January 05, 2012 4:46 PM To: Parise, Carol A.; [hidden email] Subject: RE: compute new race variable from 2 fields Even still, all of the people who are not white and not hispanic are sysmis. Change if (race1 ge 1 and race_hispanic=1) allrace=race_comb. to --> IF (race1 GE 1) allrace=race1. Joe ________________________________________ From: SPSSX(r) Discussion [[hidden email]] On Behalf Of Parise, Carol A. [[hidden email]] Sent: Thursday, January 05, 2012 7:37 PM To: [hidden email] Subject: Re: compute new race variable from 2 fields Ahh...my error in my posting. race_comb should be RACE1. for this post, i change the name race_comb to RACE1 for simplicity. this is the corrected syntax: compute AllRace=$sysmis. if (race1=0 and race_hispanic=0) allrace=0. if (race1=0 and race_hispanic=1) allrace=2. if (race1 ge 1 and race_hispanic=1) allrace=race1. value labels allrace 0 'white' 1 'black' 2 'hispanic' 3 'pacific islander' 4 'se asian' 5 'indian continent' 6 'american indian' 7 'chinese' 8 'japanese' 9 'philipino' 10 'korean' 99 'other-unknown'. -----Original Message----- From: StatisticsDoc [[hidden email]] Sent: Thursday, January 05, 2012 4:32 PM To: Parise, Carol A.; [hidden email] Subject: RE: compute new race variable from 2 fields Carol, What is race_comb and how was it computed? Best, Steve -----Original Message----- From: SPSSX(r) Discussion [[hidden email]] On Behalf Of Parise, Carol A. Sent: Thursday, January 05, 2012 7:16 PM To: [hidden email] Subject: Re: compute new race variable from 2 fields here you go! the end result gives me the correct number of hispanics and whites. but then it gives me the number of people of other races who stated that they are hispanic. compute AllRace=$sysmis. if (race1=0 and race_hispanic=0) allrace=0. if (race1=0 and race_hispanic=1) allrace=2. if (race1 ge 1 and race_hispanic=1) allrace=race_comb. value labels allrace 0 'white' 1 'black' 2 'hispanic' 3 'pacific islander' 4 'se asian' 5 'indian continent' 6 'american indian' 7 'chinese' 8 'japanese' 9 'philipino' 10 'korean' 99 'other-unknown'. -----Original Message----- From: Joseph Willey [[hidden email]] Sent: Thursday, January 05, 2012 4:02 PM To: Parise, Carol A.; [hidden email] Subject: RE: compute new race variable from 2 fields Carol, It would help if you would post the actual syntax that you are using. Joe ________________________________________ From: SPSSX(r) Discussion [[hidden email]] On Behalf Of Parise, Carol A. [[hidden email]] Sent: Thursday, January 05, 2012 6:53 PM To: [hidden email] Subject: compute new race variable from 2 fields Hi all, I suspect this is easy for one or more of you. I have 2 fields for race/ethnicity in a file. Field 1=Race1: makes people select from only 1 of 9 different races. Hispanic is not an option. Field 2=Race_Hispanic: makes people select whether or not they are hispanic (1=yes 0=no) I created a new variable called allrace. Here is what i want to do: If Race1=white and Race_Hispanic = Yes, then Allrace=Hispanic If Race1=any other race except for white and Race_hispanic =yes, then Allrace=Race1 If Race_Hispanic =no, Allrace =Race1 My syntax and it runs just fine. But, i'm screwing something up because my I am ending up with the total number of people in my Race_Hispanic=Yes field. Thanks for any syntax of wisdom. Carol ===================== 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 ===================== 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 |
Administrator
|
In reply to this post by parisec
the desired table (sans labels) is yielded from.
if (hispanic EQ 0) all_race=race1. if (race1 eq 0) and (hispanic EQ 1) all_race=2.
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me. --- "Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis." Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?" |
Thanks David. It's great to have multiple ways to achieve the same results.
I appreciate everyones help. I was spinning my wheels on this one and it seemed like it should be so easy! -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of David Marso Sent: Friday, January 06, 2012 9:30 AM To: [hidden email] Subject: Re: compute new race variable from 2 fields the desired table (sans labels) is yielded from. if (hispanic EQ 0) all_race=race1. if (race1 eq 0) and (hispanic EQ 1) all_race=2. -- View this message in context: http://spssx-discussion.1045642.n5.nabble.com/compute-new-race-variable-from-2-fields-tp5124256p5126180.html Sent from the SPSSX Discussion mailing list archive at Nabble.com. ===================== 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 |
Free forum by Nabble | Edit this page |