# st: RE: Data managment- group characteristics

 From "Nick Cox" To Subject st: RE: Data managment- group characteristics Date Thu, 21 Aug 2003 17:25:31 +0100

```Suppose I'm the second oldest child in my family,
which is true, but say the 42nd oldest child
in my neighbourhood. Excluding my older brother,
therefore, my rank changes to 41st.

Therefore, isn't this just computable from

order in neighbourhood - order in family + 1

egen norder = rank(age), by(nid)
egen forder = rank(age), by(family)
egen myorder = norder - forder + 1

Nick
n.j.cox@durham.ac.uk

> -----Original Message-----
>
> I am having trouble in figuring out how to create some
> peer variables for my data. I have a dataset of kids
> in households and i need to calculate variables that
> reflect the position of a kid (say, aged 6-17) among
> other kids (in same age group) in the residential
> neighbourhood.
>
> If i wanted to obtain simple peer variables, then the
> solution is to calculate the -peer variable- of
> interest for each kid (by excluding him/her from the
> calculation), following the rule explained in FAQ
> section on STATA webpage :
> http://stata.com/support/faqs/data/members.html
> With little modification of the rule, own siblings can
> also be net out from the above calculation of peer
> vars.
>
> Problem is in creating variables like, say relative
> birth order (RBO), for every kid in the sample using
> only data on -all other kids in the neighbourhood-
> where we need to:  (a) exclude own siblings in
> calculation & (b) retain the individual kid (for whom
> the variable is being calculated) in calculation.
>
> For kids with no siblings, there is little problem. It
> is the presence of own siblings that i am finding
> difficult to deal with. IN contrast to common peer
> group variables that are constant for kids from same
> families, this (within neighbourhood) R/BO may be
> different for siblings of different age within a
> family. Some form of nested loop (may be as an
> extension of the cited FAQ) is necessary, but I
> havent been able to construct the general form of it.
> Once done, I can calculate lots of other  variables
> (e.g. what % of kids in the peer group are older in
> age, of same age etc. etc.). Any help will be
> appreciated. I further elaborate my case below.

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```