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 (July 2011)Back to main SPSSX-L pageJoin or leave SPSSX-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Wed, 20 Jul 2011 17:31:44 +0100
Reply-To:   joan casellas <joan.casellas@eu-survey.com>
Sender:   "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From:   joan casellas <joan.casellas@eu-survey.com>
Subject:   Re: Count of unique values across variables
Comments:   To: David Marso <david.marso@gmail.com>
In-Reply-To:   <1311179054939-4616445.post@n5.nabble.com>
Content-Type:   text/plain; charset="us-ascii"

Great!!! Now works perfectly!!!!!

Thanks David!!!

Joan Casellas Vega Media Research Analyst Phone: +44 7920 761 870

-----Original Message----- From: SPSSX(r) Discussion [mailto:SPSSX-L@LISTSERV.UGA.EDU] On Behalf Of David Marso Sent: 20 July 2011 17:24 To: SPSSX-L@LISTSERV.UGA.EDU Subject: Re: Count of unique values across variables

Of course it works ;-) Just needed a few changes to fit the current data. data list list/ zip2006 zip2007 zip2008 zip2009 zip2010 zip2011. begin data 61477 61477 41365 41365 41365 41365 41365 41365 41365 end data.

* Copy the array * . VECTOR P=zip2006 TO zip2011 / #TMP(6). LOOP #I=1 to 6. + compute #TMP(#I)=P(#I). END LOOP.

* Compare to preceding variables *. LOOP #I=2 to 6. + LOOP #J=1 TO #I-1. + IF #TMP(#I)=#TMP(#J) #TMP(#I)=$SYSMIS. + END LOOP IF MISSING(#TMP(#I)). END LOOP. COMPUTE N=NVALID(#TMP1 TO #TMP5). LIST.

ZIP2006 ZIP2007 ZIP2008 ZIP2009 ZIP2010 ZIP2011 N

61477.00 . . . . . 1.00 61477.00 41365.00 . . . . 2.00 41365.00 41365.00 41365.00 41365.00 41365.00 41365.00 1.00

Number of cases read: 3 Number of cases listed: 3

joan casellas wrote: > > Have a look to the following link (is from David Marso): > > http://www.spsstools.net/Syntax/MultipleResp/CountUniqueOccurencesOfAMultipl > eResponse.txt > > I've tried it but didn't work. However, I think is what you are asking > for. > > Thanks. > > > > Joan Casellas Vega > Media Research Analyst > Phone: +44 7920 761 870 > > > -----Original Message----- > From: SPSSX(r) Discussion [mailto:SPSSX-L@LISTSERV.UGA.EDU] On Behalf Of > Nancy Rusinak > Sent: 20 July 2011 03:27 > To: SPSSX-L@LISTSERV.UGA.EDU > Subject: Count of unique values across variables > > Hello! > > I'm trying to find a way to get a count of unique values across 6 > variables: > > zip 2006 zip2007 zip2008 zip2009 zip2010 zip2011 > 61477 > 61477 41365 > 41365 41365 41365 41365 41365 41365 > > In the data above, I'd like to add a variable called "count." for the > first > case, the value of count would be "1" as there is only 1 unique zip in all > 6 > columns. For the second case, "count" would equal "2" and for the third > case, count would equal "1" > > I'm new to syntax and would appreciate any handholding you could offer > with > accomplishing this. > > My heartfelt thanks if you can help! > > Nancy > > ===================== > 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 >

-- View this message in context: http://spssx-discussion.1045642.n5.nabble.com/Count-of-unique-values-across- variables-tp4614377p4616445.html Sent from the SPSSX Discussion mailing list archive at Nabble.com.

===================== 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