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 (February 2006)Back to main SPSSX-L pageJoin or leave SPSSX-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Sat, 4 Feb 2006 23:43:38 -0500
Reply-To:     Bob Walker <rwwalker-xl@spamarrest.com>
Sender:       "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From:         Bob Walker <rwwalker-xl@spamarrest.com>
Subject:      Re: converting dichotomized single choiche response to single
              choiche categories
Comments: To: Arnaldo Ferrari Nasi <vs.arni@tiscalinet.it>
In-Reply-To:  <6.1.0.6.0.20060204165742.026ad280@pop.tiscali.it>
Content-type: text/plain; charset=us-ascii

Arnaldo,

If you have only a few variables, RECODE would be efficient...

RECODE Q1.1 (1=1) INTO Q1/ Q1.2 (1=2) INTO Q1/ Q1.3 (1=3) INTO Q1/ Q2.1 (1=1) INTO Q2 / Q2.2 (1=2) INTO Q2.

...otherwise, consider using VECTOR:

VECTOR Q=Q1.1 TO Q1.3. LOOP I = 1 TO 3. COMPUTE Q3=I. END LOOP IF Q(I)=1. EXE.

Regards,

Bob Walker Surveys & Forecasts, LLC www.surveys-forecasts.com

-----Original Message----- From: SPSSX(r) Discussion [mailto:SPSSX-L@LISTSERV.UGA.EDU] On Behalf Of Arnaldo Ferrari Nasi Sent: Saturday, February 04, 2006 11:07 AM To: SPSSX-L@LISTSERV.UGA.EDU Subject: Re: converting dichotomized single choiche response to single choiche categories

Thanks, it runs. And if I have many contiguos variable with the same structure?

i.e. Do you like citizens of... d1.1 USA (yes, no, don't know) d1.2 Great Britain (yes, no, don't know) d1.3 France (yes, no, don't know) ...

I have a file like this:

d1.1.1 d1.1.2 d1.1.3 d1.2.1 d1.2.2 d1.2.3 d1.3.1 d1.3.2 d1.3.3 etc. 1 0 0 0 1 0 0 1 0 1 0 0 1 0 0 0 0 1 0 1 0 0 0 1 1 0 0 ...

Thanks, Arnaldo.

>do repeat x=q1.1 to q1.3/y=1 to 3. >if x q1=y. >end repeat. >do repeat x=q2.1 to q2.2/y=1 to 2. >if x q2=y. >end repeat. >exe. > > > >On 04/02/2006, at 10:33 PM, Arnaldo Ferrari Nasi wrote: > >>Hi List, >> >>I have a file with all the variable like this: >> >>data list free/ id q1.1 q1.2 q1.3 q2.1 q2.2. >>begin data >>001 0 0 1 1 0 >>002 1 0 0 1 0 >>003 0 1 0 0 1 >>004 0 0 1 0 1 >>end data. >> >>I would have a file like this: >> >>data list free/ id q1 q2 >>begin data >>001 3 1 >>002 1 1 >>003 2 2 >>004 3 2 >>end data. >> >>Obviously, I can do this with a lot of if-statements, but I'd like >>to know >>if there is a faster way. >> >>Thanks in advance, >>Arnaldo. >


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