I've experieced quite a challenge regarding the restructuring of my dataset and generating new variables. In this dataset there is each time a company (target) that is acquired by another company (acquiror), which was previously owned by a third company (Seller). Most of the acquired companies are then sold again by the initial acquirer to another company. Basically I have a dataset that looks as follows
TargetID | AcquirorID | SellerID | Dealdate | DealID |
UK1 | BE2 | US3 | 21/06/1994 | 1 |
UK1 | IE4 | BE2 | 23/07/1997 | 2 |
BE5 | US3 | SL1 | 02/01/2002 | 3 |
BE5 | IT4 | US3 | 03/04/2004 | 4 |
BE5 | UK8 | IT4 | 05/06/2007 | 5 |
PO4 | GI6 | PO4 | 03/06/2009 | 6 |
PO4 | US9 | GI6 | 08/06/2010 | 7 |
AcquirorID | TargetID | Entrydate | Exitdate | EntrydealID | ExitdealID |
BE2 | UK1 | 21/06/1994 | 23/07/1997 | 1 | 2 |
IE4 | UK1 | 23/07/1997 | N.A. | 2 | N.A. |
US3 | BE5 | 02/01/2002 | 03/04/2004 | 3 | 4 |
IT4 | BE5 | 03/04/2004 | 05/06/2007 | 4 | 5 |
UK8 | BE5 | 05/06/2007 | N.A. | 5 | N.A. |
GI6 | PO4 | 03/06/2009 | 08/06/2010 | 6 | 7 |
IS9 | PO4 | 08/06/2010 | N.A. | 7 | N.A. |
I have only recently started using stata and know how to generate new variables based on existing ones. I generated the entry date and exit date ID by simply using the code below, which worked fine.
Code:
//code Entrydate// gen Entrydate = Dealdate format %tdnn/dd/CCYY Entrydate recast int Entrydate //code EntrydealID// gen Entryid = DealID
Thanks in advance.
Regards,
Gianni
0 Response to Problem with restructuring data set and generating new variables to do so
Post a Comment