Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

st: Creating variable recording for each individual charateristics of members of OTHER groups


From   Vincenzo Carrieri <[email protected]>
To   [email protected]
Subject   st: Creating variable recording for each individual charateristics of members of OTHER groups
Date   Wed, 15 Jan 2014 11:23:27 +0100

Dear Statalisters,
I have some problems in generating a variable capturing charateristcs
of members of other groups.
I read the intersting FAQ
http://www.stata.com/support/faqs/data-management/creating-variables-recording-properties/
but I think it does not cover the situation in which the interest is
on charateristics of members of other groups.

I have a data set  like this:

Individual    Day       Team    Opponent Team       Charateristic       Score
1                1          A                B
 Red                2
2                1          A                B
 Black              2,5
3                 1         A                B
 Brown             4
.
.
.
1                 1          B               A
Red                  1
2                 1          B               A
Black                3
3                 1          B               A
Brown               1
.
.
.
1                 2         A               C
Red                2
2                 2         A               C
Black              2
3                 2         A               C
Brown              5

I need to generate a variable recording for each individual and for
each day  the number of individuals in the opponent team with the same
charateristic of individual i playing in team j.
I have no problems to generate the same variables recording
charateristics of individuals playing in the same team using
combination of by, egen  and count command:

bysort team day charateristics: egen "peer_variable"=count(Score)

However, this procedure does not seem to work when the focus is on
charateristics of players of the opponent team. If I replace "team"
with "opponent team" in the above line command, stata generates me the
same identical "peer_variables" built above. I guess this is due to
the fact that my procedure is not appropriate when informations are
not  in the same row.

Any hints would be appreciated.
Thanks in advance,
V.
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index