Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Manipulating dataset in stata


From   Cesare Fracassi <[email protected]>
To   [email protected]
Subject   st: Manipulating dataset in stata
Date   Tue, 29 Jul 2008 10:49:30 -0700

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/




© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index