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]
Re: st: FW: Getting all combinations of co-occuring IDs
From
Maarten Buis <[email protected]>
To
[email protected]
Subject
Re: st: FW: Getting all combinations of co-occuring IDs
Date
Fri, 29 Nov 2013 13:19:32 +0100
On Fri, Nov 29, 2013 at 12:49 PM, Daniel Stefan Hain wrote:
> I have a dataset with investments of venture capitalists in companies. Since many deals are syndicated, it often appears that multiple investors invest in a company in the same deal. For every investor, I have a single row <snip> What I need now is a dataset that contains every appearing investor combination in one deal.
-joinby- would be one way of doing this:
*------------------ begin example ------------------
// create some example data
clear
input ///
dealid invid
1 2
1 7
1 15
1 20
2 9
2 13
3 1
end
tempfile a b
save `a'
// you make a copy of your file, where the data
// is sorted on dealid and invid is renamed
sort dealid
rename invid invid2
save `b'
// go back to the original data
use `a'
// use -joinby-
joinby dealid using `b'
// admire the result
sort dealid invid invid2
list , sepby(dealid)
*------------------- end example -------------------
* (For more on examples I sent to the Statalist see:
* http://www.maartenbuis.nl/example_faq )
Hope this helps,
Maarten
---------------------------------
Maarten L. Buis
WZB
Reichpietschufer 50
10785 Berlin
Germany
http://www.maartenbuis.nl
---------------------------------
*
* 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/