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 (March 2011)Back to main SPSSX-L pageJoin or leave SPSSX-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Sun, 6 Mar 2011 06:19:34 -0800
Reply-To:   Bruce Weaver <>
Sender:   "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From:   Bruce Weaver <>
Subject:   Re: different values in a row
In-Reply-To:   <>
Content-Type:   text/plain; charset=us-ascii

I don't have SPSS on this machine, so the following is untested, but I think it might work. You may need an EXECUTE after the loop.

numeric i1 to i4 (f1.0). /* 4 indicator variables. recode i1 to i4 (else=0). /* initialize to 0. vector v = v1 to v4 / i = i1 to i4. loop # = 1 to 4. - compute i(v(#)) = 1. /* value stored in v(#) flagged as present. end loop. compute unique_values = sum(i1 to i4).

drfg2008 wrote: > > Is there a command (or a syntax, or python program) that counts different > (numerical) values in a row. > > Example: > > > variables: V1 V2 V3 V4 > values row1: 1 2 3 4 > values row2: 1 1 1 1 > > row1 has 4 different values: 1-4 > row 2 has only one different value: 1 > > I tried to develop a python program but failed. Also couldn't find a > solution on raynald's. > > Thanks >

----- -- Bruce Weaver

"When all else fails, RTFM."

NOTE: My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above.

-- View this message in context: Sent from the SPSSX Discussion mailing list archive at

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