|
Greetings:
I am struggling to figure out how I can take multiple variables that are dichotomous and combine them into a single likert scale variable. It seems like this should be an easy thing to do but as far as I can't tell the SPSS syntax does not allow for Boolean logic and the use of multiple variables to create a new variable. I do not wish to use the multiple response sets because inevitably someone who uses the dataset will not remember to redo the set every time they open the file and they will get stuck till they remember or ask me. My dichotomous responses are from an import from access where response options a, b, c, d are scored as 0/1, 0/1, etc. So the four imported variable should really be just one. At this present time the only option I can come up with is to recoded the imported values such that if b =1 then recode to 2 and if c =1 then recode into 3 etc. I could then sum the four variables giving me the correct value. I would of course have to figure out the code for this but I don't think that will be too hard (I hope). The issue then becomes how do I drop the unneeded variables (that are now combined) and order the variables so that the new variable is not stuck at the end of the var list because that is not really where they expect to see it. If anyone can help me with the code that would be most appreciated or if you could just point me to the right command or where in the syntax ref guide too look I would appreciate that as well. I have tried to figure out the dro command but I can't even figure out which command the option is to be run under. Edgar I Sanchez, Ph.D. [hidden email] http://www.apqceducation.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 |
|
Edgar,
There are lots of ways to do this... We have done something similar to this with... Note that if there are more than one endorsed item in the series (a-d) then newvar will be missing. If (vara>max(varb,varc,vard)) newvar=1. If (varb>max(vara,varc,vard)) newvar=2. If (varc>max(vara,varb,vard)) newvar=3. If (vard>max(vara,varb,varc)) newvar=4. Or you could use.. (assuming you are sure there are no series where there are no series with multiple responses--or assuming that you want the first item coded). Do if vara=1. compute newvar=1. Else if varb=1. compute newvar=2. Else if varc=1 compute newvar=3. Else if vard=1. compute newvar=4. Else compute newvar=<yourmissingvalue> End if. Then you can either use... Delete vars vara to vard. Or a SAVE outfile=<newfile>/keep=ID newvar. Melissa -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Sanchez, Edgar Sent: Monday, May 26, 2008 11:21 AM To: [hidden email] Subject: [SPSSX-L] recoding, dropping, and reordering variables Greetings: I am struggling to figure out how I can take multiple variables that are dichotomous and combine them into a single likert scale variable. It seems like this should be an easy thing to do but as far as I can't tell the SPSS syntax does not allow for Boolean logic and the use of multiple variables to create a new variable. I do not wish to use the multiple response sets because inevitably someone who uses the dataset will not remember to redo the set every time they open the file and they will get stuck till they remember or ask me. My dichotomous responses are from an import from access where response options a, b, c, d are scored as 0/1, 0/1, etc. So the four imported variable should really be just one. At this present time the only option I can come up with is to recoded the imported values such that if b =1 then recode to 2 and if c =1 then recode into 3 etc. I could then sum the four variables giving me the correct value. I would of course have to figure out the code for this but I don't think that will be too hard (I hope). The issue then becomes how do I drop the unneeded variables (that are now combined) and order the variables so that the new variable is not stuck at the end of the var list because that is not really where they expect to see it. If anyone can help me with the code that would be most appreciated or if you could just point me to the right command or where in the syntax ref guide too look I would appreciate that as well. I have tried to figure out the dro command but I can't even figure out which command the option is to be run under. Edgar I Sanchez, Ph.D. [hidden email] http://www.apqceducation.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 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 |
|
One more note: if you can use the mult response set definitions that are used by the Chart Builder and by Custom Tables, they persist with the dataset. No need to keep redefining them. The older MR sets that are only used by the MULT RESPONSE procedure do only persist through the syntax.
HTH, Jon Peck -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Melissa Ives Sent: Monday, May 26, 2008 12:59 PM To: [hidden email] Subject: Re: [SPSSX-L] recoding, dropping, and reordering variables Edgar, There are lots of ways to do this... We have done something similar to this with... Note that if there are more than one endorsed item in the series (a-d) then newvar will be missing. If (vara>max(varb,varc,vard)) newvar=1. If (varb>max(vara,varc,vard)) newvar=2. If (varc>max(vara,varb,vard)) newvar=3. If (vard>max(vara,varb,varc)) newvar=4. Or you could use.. (assuming you are sure there are no series where there are no series with multiple responses--or assuming that you want the first item coded). Do if vara=1. compute newvar=1. Else if varb=1. compute newvar=2. Else if varc=1 compute newvar=3. Else if vard=1. compute newvar=4. Else compute newvar=<yourmissingvalue> End if. Then you can either use... Delete vars vara to vard. Or a SAVE outfile=<newfile>/keep=ID newvar. Melissa -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Sanchez, Edgar Sent: Monday, May 26, 2008 11:21 AM To: [hidden email] Subject: [SPSSX-L] recoding, dropping, and reordering variables Greetings: I am struggling to figure out how I can take multiple variables that are dichotomous and combine them into a single likert scale variable. It seems like this should be an easy thing to do but as far as I can't tell the SPSS syntax does not allow for Boolean logic and the use of multiple variables to create a new variable. I do not wish to use the multiple response sets because inevitably someone who uses the dataset will not remember to redo the set every time they open the file and they will get stuck till they remember or ask me. ===================== 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 Sanchez, Edgar
At 12:21 PM 5/26/2008, Sanchez, Edgar wrote:
> I am struggling to figure out how I can take multiple > variables that are dichotomous and combine them into a single > Likert scale variable. It seems like this should be an easy thing > to do but as far as I can't tell the SPSS syntax does not allow for > Boolean logic and the use of multiple variables to create a new variable. Actually, SPSS does both, easily and routinely. Melissa Ives gave you one response on this. For the general computational capabilities of SPSS, in the Command Syntax Reference, see . Article Universals, section "Transformation Expressions" . Articles on commands COMPUTE, IF, and DO IF. . RECODE doesn't deal with multiple variables to one variable, but anyone writing SPSS transformation code should be familiar with it. >The issue then becomes how do I drop the unneeded variables (that >are now combined) and order the variables so that the new variable >is not stuck at the end of the var list Various ways. The following takes a pass through the data, so for a big dataset it'll take a little time, but it's what I'd do. If your dataset has variables FIRST, ...., BEFORE, RESPONSE1, RESPONSE2, RESPONSE3, RESPONSE4, RESPONSE5, AFTER, ..., LAST and you've computed variable LIKERT from RESPONSE1 to RESPONSE5, then (not tested), ADD FILES /FILE=* /DROP=RESPONSE1 TO RESPONSE5 /KEEP=FIRST TO BEFORE, LIKERT, AFTER TO LAST, ALL. In this case, the 'ALL' should have no effect, but I always include it on KEEP lists to ensure that variables I've forgotten to mention at least are kept at the end of the dataset. -Good luck, Richard ===================== 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 |
