[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
st: Manipulating dataset in stata
Hi All,
I have a db that looks like this:
ID N
1 1
2 0
3 4
4 2
5 2
6 0
.........
10 1
(the actual db is much larger than that)
I would like to create a new dataset that contains the nxn possible
combinations of observations and takes the differences between the Ns:
ID1 ID2 DeltaN
1 1 0
1 2 1
1 3 -3
1 4 -1
........................
1 10 0
2 1 -1
2 2 0
2 3 -4
.......
and so on for the nxn possible combinations...
any idea how to code that in stata?
thanks in advance...
Cesare
*
* 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/