|
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
bweaver@lakeheadu.ca
http://sites.google.com/a/lakeheadu.ca/bweaver/
"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: http://spssx-discussion.1045642.n5.nabble.com/different-values-in-a-row-tp3411280p3411438.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
|