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 16:47:53 -0500
Reply-To:     Deepa Bhat <deepa_bhat@jsi.com>
Sender:       "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From:         Deepa Bhat <deepa_bhat@jsi.com>
Subject:      Re: Recoding multiple variables into one new variable
Comments: To: Syed.S.Hashmi.1@uth.tmc.edu
Content-Type: text/plain; charset=US-ASCII

Thanks everyone for their input.

I tried this output and it works. I have tried it with a few variables and so far when I do frequencies, they match when I do them individually.

Thanks again. This is a really great group!

Deepa

>>> "Hashmi, Syed S" <Syed.S.Hashmi.1@uth.tmc.edu> 01/30/08 11:55 AM >>> 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


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