Hello, Let's say that I have many individuals clustered (being the cluster a house, clinic, plot, etc). Each individual has an identification number, all individuals have characteristics such as weight, height, sex, income, etc, and they all have been measured multiple times. I want to calculate the sum of weights, sum of heights, sum of income, etc, for ONLY all those individuals that are equal, greater, or smaller THAN an specific subject in the cluster or group; the subject individual is the one in the indicated row. How can I do that in the most accurate and efficient way? The original table with data looks like this one: cluster year measurement individual # height weight income status 1 2000 1 1 1.60 70 L 2 1.70 70 L 3 1.80 70 L The resulting table should look more or less like the one below. cluster year measurement individual # height weight income status heights of individuals larger than the subject individual weight of individuals heavier than the subject individual income of individuals wealthier than the subject 1 2000 1 1 1.60 70 L I really appreciate any help that I can get; This might seem very simple for many, but I have not been able to solve this. Thanks for reading. VR
... View more