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: data manipulation question


From   DC <[email protected]>
To   Statalist Statalist <[email protected]>
Subject   st: data manipulation question
Date   Tue, 10 Aug 2010 19:23:58 -0400

Hi All,

I have a question about the correct procedure to assign indicators of
events occurring to  nearest neighbors to individual identifiers .
Specifically, I have data that look something like this:

id  race  quarter     move      nn1     nn2       nn3
1      1          1          0          2          3         4
1      1          2          0          2          3         4
1      1          3          1          2          3         4
2      0          1          0          1          4         3
2      0          1          1          1          4         3
3      0          1          0           5         1         4
3      0          2          1           5         1         4
4      0          1          0           3          2        5
4      0          2          0           3          2        5
4      0          3          1           3          2        5
5      1          1          0            5        2         1
5      1          2          1            5        2         1

where id, race, quarter, and move are pretty straight forward. nn1,
nn2, nn3 denote a ranking of the 3  nearest neighbors to unit_ i.

I would like to construct indicators first denoting whether unit_ i
saw a move in nn_ j in quarter_ t. Conditional on seeing a move  in
nn_ j
I would like to assign a racial indicator. In other words, something like this:

id  race  quarter     move      nn1     nn2       nn3     move_nn1
move_nn2   move_nn3
1      1          1          0          2          3         4
     0               0               0
1      1          2          0          2          3         4
     2              2                0
1      1          3          1          2          3         4
     0              0                2
2      2          1          0          1          4         3
     0               0               0
2      2          2          1          1          4         3
     0               0               2
3      2          1          0           5         1         4
    0                0              0
3      2          2          1           5         1         4
    1               0               0
4      2          1          0           3          2        5
    0              0               0
4      2          2          0           3          2        5
    2             2                1
4      2          3          1           3          2        5
    0            0                0
5      1          1          0            3        2         1
    0           0                 0
5      1          2          1            3        2         1
     2            2                  0


It is a bit complicated. Any help would be greatly appreciated.

Regards,
Marcus




Marcus Casey, Ph.D.
Duke University
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


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