Hi Sarah,
This should do the trick, but I didn't test it:
compute greater = 0.
compute same 0.
compute less = 0.
do repeat #x = Xage.1 to Xage.100.
+ if (age > #x) greater = greater + 1.
+ if (age = #x) same = same + 1.
+ if (age < #x) less = less + 1.
end repeat print.
exe.
Cheers!!
Albert-Jan
--- Sarah van Mastrigt <
[hidden email]> wrote:
> Hi-
>
> I'm sure there's a simple solution to this problem,
> but I can't seem to
> find it, and my knowledge of syntax is pretty
> limited. I am trying to carry
> out a 'count' function, but rather than specifying a
> particular value or
> range of values to count, I want to count
> (separately) the number of values
> that are greater than, less than, or equal to, the
> value of another
> variable (AGE) in my data. For example:
>
> AGE Xage.1 Xage.2 Xage.3 Xage.4
> Xage.5....Xage.100
> 15.2 18.36 15.4 12.3 15.2 25.67
>
> So in the example above, I am looking to create 3
> new variables with the
> following counts:
>
> 'Greater than AGE'= 3
> 'Same as AGE'= 1
> 'Less than AGE'=1
>
> Any suggestions would be gratefully received! With
> thanks,
>
> Sarah
>
Cheers!
Albert-Jan
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Did you know that 87.166253% of all statistics claim a precision of results that is not justified by the method employed? [HELMUT RICHTER]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
____________________________________________________________________________________
Cheap talk?
Check out Yahoo! Messenger's low PC-to-Phone call rates.
http://voice.yahoo.com