LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (January 2008)Back to main SPSSX-L pageJoin or leave SPSSX-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 30 Jan 2008 17:54:28 +0100
Reply-To:     samir.omerovic@gfk.ba
Sender:       "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From:         "[Samir OmeroviŠ]" <samir.omerovic@gfk.ba>
Subject:      Re: Recoding multiple variables into one new variable
Comments: To: "Hashmi, Syed S" <Syed.S.Hashmi.1@uth.tmc.edu>
In-Reply-To:  <1F423A0A78EC5442A3DE45AF10059EAE0A59F23B@UTHEVS3.mail.uthouston.edu>
Content-Type: text/plain;charset=iso-8859-1

Hi there,

there is simpler solution to recode

RECODE q3_1a q3_1b q3_1c (1=1) (2=2) (99=99) INTO new3_1 new3_1 new3_1 . execute.

and also there is SUM

Compute new3_1=SUM(q3_1a,q3_1b,q3_1c). execute.

Of course both methods assume there is only one value in each row so it is not actual multiple answer.

BR Samir

> Deepa, > > I don't know if this is the best method, but you can do that by using a > different RECODE command for each of the original variables (tested in > v.16): > > RECODE > q3_1a > (1=1) (2=2) (99=99) INTO new3_1 . > RECODE > q3_1b > (1=1) (2=2) (99=99) INTO new3_1 . > RECODE > q3_1c > (1=1) (2=2) (99=99) INTO new3_1 . > RECODE > q3_1d > (1=1) (2=2) (99=99) INTO new3_1 . > VARIABLE LABELS new3_1 'Clean table or tray'. > EXECUTE . > > > A couple of points to remember: > 1. This will only work if you don't have rows with data in more than one > column. If you do, then the latter variable will overwrite the previous > one. > 2. I haven't included the SYSMIS values in the code. I've done this > because I'm assuming that if the first row might have "2" for q3_1a but > have SYSMIS for all the other three vars. If that is true, then the > code will overwrite "2" with SYSMIS in new3_1. > > HTH. > > > Shahrukh > > > > > >> -----Original Message----- >> From: SPSSX(r) Discussion [mailto:SPSSX-L@LISTSERV.UGA.EDU] On Behalf > Of >> Deepa Bhat >> Sent: Wednesday, January 30, 2008 10:12 AM >> To: SPSSX-L@LISTSERV.UGA.EDU >> Subject: Recoding multiple variables into one new variable >> >> Hi everyone, >> >> I have a database in which the data entry staff entered the responses >> to one question in four different columns. I would like to combine it >> all into one column. The syntax I have so far is the following: >> >> RECODE >> q3_1a >> (1=1) (2=2) (99=99) (SYSMIS=SYSMIS) INTO new3_1 . >> VARIABLE LABELS new3_1 'Clean table or tray'. >> EXECUTE . >> >> >> SPSS won't let me recode another variable (q3_1b q3_1c q3_1d) into >> new3_1. I don't have to worry about any response overriding another > one >> because each response is affiliated with a different person. >> >> I am trying to avoid doing frequencies of each and tallying it up the >> total by hand. Is there a syntax that will allow me to recode multiple >> variables into one variable? >> >> Thanks so much, >> Deepa >> >> ===================== >> To manage your subscription to SPSSX-L, send a message to >> LISTSERV@LISTSERV.UGA.EDU (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 > LISTSERV@LISTSERV.UGA.EDU (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 >

-- GfK BH Samir Omerovic

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


Back to: Top of message | Previous page | Main SPSSX-L page