Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


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

st: Merging two datasets multiple times


From   "Pavlos C. Symeou" <p.symeou@lmu.de>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   st: Merging two datasets multiple times
Date   Wed, 07 Apr 2010 10:49:29 +0200

Dear Statalisters,

maybe you can assist with the following.

I have two datasets (A and B) which I need to merge.

Dataset A records a number of patents which are assigned multiple International Patent Classifications (ipc) as in:
id        ipc_1        ipc_2
1        AAAA        BBBB
2        AAAA        CCCC
3        DDDD     CCCC

Dataset B lists all IPCs in long format and for each IPC a set of 39 characteristics as follows:
ipc          sic_1        sic_2        sic_3....          sic_39
AAAA      zzzzz          xxxxx           yyyyyy            eeeee
BBBB     tttttt            rrrrrr           ooooo           uuuuu
CCCC   www         gggg          pppp             qqqq


I want to merge datasets A and B so that the merged dataset looks like this:

id ipc_1 ipc_2 sic_1 sic_2 sic_3.... sic_39 sic_40 sic_41 sic_42.... sic_78.... 1 AAAA BBBB zzzzz xxxxx yyyyyy eeeee tttttt rrrrrr ooooo uuuuu 2 AAAA CCCC zzzzz xxxxx yyyyyy eeeee www gggg pppp qqqq

Basically, for every patent I want to have all its IPCs and all SICs in the same row.

Best,

Pavlos

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index