[Top][All Lists]

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

help with syntax

From: Michel Boaventura
Subject: help with syntax
Date: Sun, 16 May 2010 08:50:05 -0300


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!


reply via email to

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