pspp-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: help with syntax


From: Ben Pfaff
Subject: Re: help with syntax
Date: Sun, 08 Aug 2010 15:18:50 -0700
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux)

"Michel Boaventura" <address@hidden> writes:

> I'got a base on PSPP which has only three columns: id, gender and
> height.
> I need to, for each male, to find the female who has the closest
> height of this male.
>
>
> On a pseudocode, it would be very easy (it is not optimized at all):
>
>
> for (i=0;i<numcases;i++) {
>     if (bank[i][gender] = 1) break;//only do it for males
>     delta = 1;
>     for (j=0;j<numcases;j++) {
>         if (bank[i][gender] = 0) break;//only compare with females
>         tmp = abs(bank[i]['height'] - bank[j]['height']);
>         if (tmp < delta) {
>             delta = tmp;
>             bank[i]['match'] = bank[j]['id];
>         }
>     }
> }
>
>
> How do I do it on PSPP? I've searched on the docs, but coudn't find a
> loop structure or
> something similar to it, since I need to walk on all the cases twice.

Hi Michel.

It looks to me like you never got an answer to this question.  I
don't have a good answer, either; this kind of problem is
difficult in PSPP or in SPSS.

Did you try asking your question on the SPSS newsgroup or the
spssx mailing list?  Those are good resources too.

Ben
-- 
Ben Pfaff 
http://benpfaff.org



reply via email to

[Prev in Thread] Current Thread [Next in Thread]