Hello,

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.

Thank you!

Michel

_______________________________________________
Pspp-users mailing list
Pspp-users@gnu.org
http://lists.gnu.org/mailman/listinfo/pspp-users

Reply via email to