Dear Statalist,
I'm relatively new to stata and am struggling with the following situation.
I have a dataset where each company has its own id (AcquirorID). The dataset consist of a set of transactions where a company buys another company together with the date of the transaction (Completeddate).
Basically, I want to generate a new variable called Acq_exp5, which counts the number of times this company appears again as an acquiror in a transaction up to 5 years prior to the respective deal. I have tried by using this code ...
... but it returns a type mismatch. Could anyone help me in pointing out my mistake?
Below I provide an example of my dataset
Kind regards,
Gianni
I'm relatively new to stata and am struggling with the following situation.
I have a dataset where each company has its own id (AcquirorID). The dataset consist of a set of transactions where a company buys another company together with the date of the transaction (Completeddate).
Basically, I want to generate a new variable called Acq_exp5, which counts the number of times this company appears again as an acquiror in a transaction up to 5 years prior to the respective deal. I have tried by using this code ...
Code:
egen Acq_exp5 = count(AcquirorID) if Completeddate < Completeddate & Completeddate > (Completeddate - (365*5)) , by (AcquirorID)
Below I provide an example of my dataset
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input str10 DealNumber str17 TargetID str16 AcquirorID int Completeddate "1909620718" "AT9050064867" "AT9010001013" 21042 "428323" "" "AT9010001013" 17607 "1601361353" "DE7330001161" "AT9010001013" 19829 "139304" "AT9050021036" "AT9010001013" 16411 "36845" "" "AT9010001013" 14077 "1909559724" "DE8190496081" "AT9010001013" 21673 "1601429472" "DE7270093528" "AT9010001013" 20070 "279719" "AT9110289384" "AT9010001013" 17066 "428159" "" "AT9010001013" 17607 "1909052627" "AT9110222298" "AT9010001013" 19705 "1941168400" "DE8230598147" "AT9010001732" 21608 "1941025510" "DE8290162551" "AT9010001732" 21185 "1909023921" "DE7331037629" "AT9010002302" 19359 "127909" "AT9010041204" "AT9010003139" 16300 "1909579108" "CHCHE101392565" "AT9010008647" 20940 "129944" "AT9150011918" "AT9010008647" 15592 "87362" "" "AT9010008647" 15060 "1601020282" "AT9010007615" "AT9010010464" 17918 "1909036895" "CHCHE101016257" "AT9010010464" 20392 "516334" "AT9010016115" "AT9010010464" 17440 "1909472120" "CHCHE107818120" "AT9010010464" 20671 "1909556236" "AT9010016115" "AT9010010464" 21678 "1909047257" "DE7290278251" "AT9010010464" 20418 "1601476515" "AT9050053195" "AT9010012047" 20200 "378745" "AT9010015861" "AT9010015034" 17442 "1601440537" "" "AT9010015034" 20113 "1601241049" "CHCHE106320403" "AT9010016240" 18616 "1909061042" "CHCHE106840163" "AT9010027783" 19711 end format %tdnn/dd/CCYY Completeddate
Kind regards,
Gianni
Comment