Hi there, SPSS folks, I have just been provided a dataset from surveymonkey for a project. The database breaks the answers down into different columns (new variables) for each answer option. Fake example. What is your interest level? Answers: low, medium, high.
Instead of providing me with a variable (interest level) with 1=low, 2=medium and 3 = high, the data set has one column for low (with either 0 or 1) as the data, same for medium and same for high. My question is how to combine these multiple columns into one variable with different answer options: variable =interest level with 1=low, 2=medium and 3=high. I have done lots of recoding of data from one variable, but have never had to combine answers from multiple variables into one.
Can you point me in the right direction? This is a quick project, and I am not great with syntax, so if there is anyway you can provide this via point and click tools within SPSS that would be my preference.
Thanks! Brenda
|
I'll bet there are a number of ways to do this. One example: Compute interest=9. Do repeat x=low medium high/y=1 2 3. + if (x eq 1) interest=y. End repeat. Missing values interest(9). That works if you have a few items. But if you have many, ALL with the same response format. Numeric x1 a2 a3 a4 t6 t7 ww y78(f1.0). Vector new=x1 to y78. Loop #i=1 to >number of new variables<. Compute new(#i)=9. Do repeat x=low medium high/y=1 2 3. + if (x eq 1) new(#i)=y. End repeat. End loop. Missing values x1 to y78(9). If you have varied response formats, .e., 1-3, 1-6, etc, I think you have no simple choice but to chunk the code by response format. Gene Maguin From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Brenda Zollitsch Hi there, SPSS folks, I have just been provided a dataset from surveymonkey for a project. The database breaks the answers down into different columns (new variables) for each answer option. Fake example. What is your interest level? Answers: low, medium, high. Instead of providing me with a variable (interest level) with 1=low, 2=medium and 3 = high, the data set has one column for low (with either 0 or 1) as the data, same for medium and same for high. My question is how to combine these multiple columns into one variable with different answer options: variable =interest level with 1=low, 2=medium and 3=high. I have done lots of recoding of data from one variable, but have never had to combine answers from multiple variables into one. Can you point me in the right direction? This is a quick project, and I am not great with syntax, so if there is anyway you can provide this via point and click tools within SPSS that would be my preference. Thanks! Brenda |
In reply to this post by Brenda Zollitsch
Brenda Assuming that your three columns are mutually exclusive: File > New > Syntax Type in the following using your own col names (start in col 1 and don’t forget the full stops!) compute rank = v1*100+v2*10+v3. recode rank (100=1)(10=2). freq rank. Run > All Get back if you need more help. John F Hall (Mr) Email: [hidden email] Website: www.surveyresearch.weebly.com Skype: surveyresearcher1 Phone: (+33) (0) 2.33.45.91.47 From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Brenda Zollitsch Hi there, SPSS folks, I have just been provided a dataset from surveymonkey for a project. The database breaks the answers down into different columns (new variables) for each answer option. Fake example. What is your interest level? Answers: low, medium, high. Instead of providing me with a variable (interest level) with 1=low, 2=medium and 3 = high, the data set has one column for low (with either 0 or 1) as the data, same for medium and same for high. My question is how to combine these multiple columns into one variable with different answer options: variable =interest level with 1=low, 2=medium and 3=high. I have done lots of recoding of data from one variable, but have never had to combine answers from multiple variables into one. Can you point me in the right direction? This is a quick project, and I am not great with syntax, so if there is anyway you can provide this via point and click tools within SPSS that would be my preference. Thanks! Brenda |
In reply to this post by Brenda Zollitsch
Made up example for 3 interest variables-- (interest_1 interest_2 interest_3 coded 1 = selected). Compute interest = -9. IF interest_1 = 1 interest = 1. IF interest_2 = 1 interest = 2. IF interest_3 = 1 interest = 3. CROSSTABS interest BY interest_1 interest_2 interest_3 Cases with interest = -9 were not coded into the single variable. Cross tabs will show you if any cases are miscoded. Jim Marks Sr Market Research Manager National Market Research Kaiser Foundation Health Plan of the Mid-Atlantic States, Inc. 2101 E. Jefferson St. Rockville, MD 20852 Phone: (301) 816-6822 Cell Phone: (301) 456-6164 NOTICE TO RECIPIENT: If you are not the intended recipient of this e-mail, you are prohibited from sharing, copying, or otherwise using or disclosing its contents. If you have received this e-mail in error, please notify the sender immediately by reply e-mail and permanently delete this e-mail and any attachments without reading, forwarding or saving them. Thank you. From: Brenda Zollitsch <[hidden email]> To: [hidden email] Date: 04/11/2012 01:22 PM Subject: Question about combining seperate answer columns in dataset into one variable Sent by: "SPSSX(r) Discussion" <[hidden email]> Hi there, SPSS folks, I have just been provided a dataset from surveymonkey for a project. The database breaks the answers down into different columns (new variables) for each answer option. Fake example. What is your interest level? Answers: low, medium, high. Instead of providing me with a variable (interest level) with 1=low, 2=medium and 3 = high, the data set has one column for low (with either 0 or 1) as the data, same for medium and same for high. My question is how to combine these multiple columns into one variable with different answer options: variable =interest level with 1=low, 2=medium and 3=high. I have done lots of recoding of data from one variable, but have never had to combine answers from multiple variables into one. Can you point me in the right direction? This is a quick project, and I am not great with syntax, so if there is anyway you can provide this via point and click tools within SPSS that would be my preference. Thanks! Brenda |
Administrator
|
In reply to this post by Brenda Zollitsch
"I am not great with syntax, so if there is anyway you can provide this via point and click tools ..."
So Sorry, that COMPUTE dialog is a complete pain in the ass! As a general rule I will *NOT* walk anyone through a point and click session without a billing address! Time to open a syntax window. COMPUTE newvar=SUM(v1*1,v2*2,v3*3). --- HTH David --
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?" |
Nice solution.
Rick Oliver Senior Information Developer IBM Business Analytics (SPSS) E-mail: [hidden email] Phone: 312.893.4922 | T/L: 206-4922 From: David Marso <[hidden email]> To: [hidden email] Date: 04/11/2012 01:07 PM Subject: Re: Question about combining seperate answer columns in dataset into one variable Sent by: "SPSSX(r) Discussion" <[hidden email]> "I am not great with syntax, so if there is anyway you can provide this via point and click tools ..." So Sorry, that COMPUTE dialog is a complete pain in the ass! As a general rule I will *NOT* walk anyone through a point and click session without a billing address! Time to open a syntax window. COMPUTE newvar=SUM(v1*1,v2*2,v3*3). --- HTH David -- Brenda Zollitsch wrote > > Hi there, SPSS folks, > > I have just been provided a dataset from surveymonkey for a project. > > The database breaks the answers down into different columns (new > variables) > for each answer option. Fake example. What is your interest level? > Answers: low, medium, high. > Instead of providing me with a variable (interest level) with 1=low, > 2=medium and 3 = high, the data set has one column for low (with either 0 > or 1) as the data, same for medium and same for high. > > My question is how to combine these multiple columns into one variable > with > different answer options: variable =interest level with 1=low, 2=medium > and > 3=high. > > I have done lots of recoding of data from one variable, but have never had > to combine answers from multiple variables into one. > > Can you point me in the right direction? > > This is a quick project, and I am not great with syntax, so if there is > anyway you can provide this via point and click tools within SPSS that > would be my preference. > > Thanks! > > Brenda > -- View this message in context: http://spssx-discussion.1045642.n5.nabble.com/Question-about-combining-seperate-answer-columns-in-dataset-into-one-variable-tp5633564p5633635.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 |
Administrator
|
In reply to this post by Maguin, Eugene
Here is how I would deal with 'many' of such abominations
(what a stupid way for a piece of SW to output a variable or do they consider everything open game for mult response and not believe in parsimony?). -- DATA LIST /W1 TO W6 1-6 X1 TO X3 8-10 Y1 TO Y4 12-15 Z1 TO Z2 17-18. BEGIN DATA 000001 100 0100 10 100000 010 1000 01 000100 001 0010 10 END DATA. ** Note the potentially brain numbing double use of Var to represent ** both the VECTOR and the accumulated value ;-). ** Also might ask, where in the hell is the initialization? ** We *don't* need any ;-)))). VECTOR W=W1 TO W6 / X= X1 TO X3 /Y=Y1 TO Y4 /Z= Z1 TO Z2 . DO REPEAT Var=W X Y Z /MAXCAT=6 3 4 2. + LOOP #=1 TO MAXCAT. + COMPUTE Var=SUM(Var,Var(#)*#). + END LOOP IF V > 0. END REPEAT. LIST W X Y Z.
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?" |
Administrator
|
David's example gave me error messages until I changed
+ END LOOP IF V > 0. to + END LOOP IF Var > 0. ;-) Also, if the sets of indicators can be read in as string variables, then you could also just use the INDEX function, like this: DATA LIST LIST /Wstring (a6) Xstring (A3) Ystring (a4) Zstring (A2). BEGIN DATA 000001 100 0100 10 100000 010 1000 01 000100 001 0010 10 END DATA. DO REPEAT New = W X Y Z / Old = Wstring to Zstring . - COMPUTE New = index(Old,'1'). END REPEAT. FORMATS W to Z (f1). LIST. OUTPUT: Wstring Xstring Ystring Zstring W X Y Z 000001 100 0100 10 6 1 2 1 100000 010 1000 01 1 2 1 2 000100 001 0010 10 4 3 3 1 Number of cases read: 3 Number of cases listed: 3
--
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/). |
Administrator
|
Yeah, my mistake ;-(
I changed V to Var in all but one place after pasting the syntax. OTOH: It might have been deliberate to keep you all on your toes ;-) ---
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?" |
Administrator
|
I assumed the latter. ;-)
--
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/). |
In reply to this post by Brenda Zollitsch
CONTENTS DELETED
The author has deleted this message.
|
Free forum by Nabble | Edit this page |