Hi everyone,
I need your help with some data manipulation work. I have a series of categorical variables (YES/NO), Q1 through Q10, for owners of different types of birds. I want to recode the variables so that any respondent saying YES to at least any two of the questions (Q1 through Q10) will be defined as an owner of multiple types of birds. How can I recode in a time-efficient way using syntax or something else? Thanks in advance for your help! Matt ===================== 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 |
I would not recode the existing data since you will lose the definition of what type of bird is owned.
I would create a new variable/indicator for multiple bird ownership. This way you would still be able to identify which birds are owned together. Compute multibird=(sum.1(q1 to q10) > 1). Melissa -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Zhou, Liuning Sent: Wednesday, July 11, 2012 1:34 PM To: [hidden email] Subject: [SPSSX-L] recoding a series of variables Hi everyone, I need your help with some data manipulation work. I have a series of categorical variables (YES/NO), Q1 through Q10, for owners of different types of birds. I want to recode the variables so that any respondent saying YES to at least any two of the questions (Q1 through Q10) will be defined as an owner of multiple types of birds. How can I recode in a time-efficient way using syntax or something else? Thanks in advance for your help! Matt ===================== 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 PRIVILEGED AND CONFIDENTIAL INFORMATION This transmittal and any attachments may contain PRIVILEGED AND CONFIDENTIAL information and is intended only for the use of the addressee. If you are not the designated recipient, or an employee or agent authorized to deliver such transmittals to the designated recipient, you are hereby notified that any dissemination, copying or publication of this transmittal is strictly prohibited. If you have received this transmittal in error, please notify us immediately by replying to the sender and delete this copy from your system. You may also call us at (309) 827-6026 for assistance. ===================== 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 Zhou, Liuning
If you've coded such that 1=Yes and 0=No, you can do it with a single COMPUTE.
COMPUTE multibirds = sum(Q1 to Q10) GE 2. This also assumes variables Q1 to Q10 are contiguous in the file. If not, list each one separated by commas. Another option: Use COUNT to get a variable giving you the number of Yes responses, then RECODE it to have only two values (1 if the count GE 2, 0 otherwise). See examples in the fine manual.
--
Bruce Weaver bweaver@lakeheadu.ca http://sites.google.com/a/lakeheadu.ca/bweaver/ "When all else fails, RTFM." PLEASE NOTE THE FOLLOWING: 1. My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above. 2. The SPSSX Discussion forum on Nabble is no longer linked to the SPSSX-L listserv administered by UGA (https://listserv.uga.edu/). |
Be aware that records missing all values from Q1-Q10 will be missing if you use a sum, but will be zero if you use a count.
-----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Bruce Weaver Sent: Wednesday, July 11, 2012 2:30 PM To: [hidden email] Subject: Re: [SPSSX-L] recoding a series of variables If you've coded such that 1=Yes and 0=No, you can do it with a single COMPUTE. COMPUTE multibirds = sum(Q1 to Q10) GE 2. This also assumes variables Q1 to Q10 are contiguous in the file. If not, list each one separated by commas. Another option: Use COUNT to get a variable giving you the number of Yes responses, then RECODE it to have only two values (1 if the count GE 2, 0 otherwise). See examples in the fine manual. Zhou, Liuning wrote > > Hi everyone, > > I need your help with some data manipulation work. > > I have a series of categorical variables (YES/NO), Q1 through Q10, for > owners of different types of birds. I want to recode the variables so > that any respondent saying YES to at least any two of the questions > (Q1 through > Q10) > will be defined as an owner of multiple types of birds. How can I > recode in a time-efficient way using syntax or something else? > > Thanks in advance for your help! > > Matt > > ===================== > To manage your subscription to SPSSX-L, send a message to > LISTSERV@.UGA (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 > ----- -- Bruce Weaver [hidden email] http://sites.google.com/a/lakeheadu.ca/bweaver/ "When all else fails, RTFM." NOTE: My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above. -- View this message in context: http://spssx-discussion.1045642.n5.nabble.com/recoding-a-series-of-variables-tp5714145p5714148.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 PRIVILEGED AND CONFIDENTIAL INFORMATION This transmittal and any attachments may contain PRIVILEGED AND CONFIDENTIAL information and is intended only for the use of the addressee. If you are not the designated recipient, or an employee or agent authorized to deliver such transmittals to the designated recipient, you are hereby notified that any dissemination, copying or publication of this transmittal is strictly prohibited. If you have received this transmittal in error, please notify us immediately by replying to the sender and delete this copy from your system. You may also call us at (309) 827-6026 for assistance. ===================== 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 Zhou, Liuning
Melissa and Bruce sent neat solutions, including suggesting use of COUNT. I
would recommend the latter as an intermediate stage as you can then see the actual distribution of multiple ownership. COUNT multibird = q1 to q10 (1). FREQ multibird. You can also use MULT RESPONSE to get summary tables. MULT RESP groups multibird2 (q1 to q10 (1)) /freq multibird2 /tab multibird2 by multibird2. You can't save multibird2, so you need to repeat the syntax if you use it with tabulation by other variables, which also have to be declared with /var <varlist> Inside the MULT RESP command. John F Hall (Mr) Email: [hidden email] Website: www.surveyresearch.weebly.com -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Zhou, Liuning Sent: 11 July 2012 20:34 To: [hidden email] Subject: recoding a series of variables Hi everyone, I need your help with some data manipulation work. I have a series of categorical variables (YES/NO), Q1 through Q10, for owners of different types of birds. I want to recode the variables so that any respondent saying YES to at least any two of the questions (Q1 through Q10) will be defined as an owner of multiple types of birds. How can I recode in a time-efficient way using syntax or something else? Thanks in advance for your help! Matt ===================== 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 |