Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

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

st: Merging two datasets multiple times

From   "Pavlos C. Symeou" <>
To   "" <>
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.



*   For searches and help try:

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