I am working with a panel data of firms (BvDIDnumber/BvDIDnumber_U being the unique firm ID for each firm) which have been matched using -rangejoin- with up to a maximum of 5 control firms per treated firm. The control firms are suffixed with _U. The two groups (treated and control) were split based on pe==1 for treated firms and 0 otherwise.
Below is an example of my data set (there are many more variables in the data):
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input str15 BvDIDnumber double(TotalAssets Turnover) float(ROA1 sic2 DealYear pe) str15 BvDIDnumber_U double(TotalAssets_U Turnover_U) float ROA1_U "GB00002404" 77092 24610 .0258652 44 2004 1 "GB03783705" 54125.838 12219.749 .036423936 "GB00002404" 77092 24610 .0258652 44 2004 1 "GB01454033" 60813.893 14912.656 .02012869 "GB00002404" 77092 24610 .0258652 44 2004 1 "GB03971528" 48427.702 41677.778 .032598924 "GB00002404" 77092 24610 .0258652 44 2004 1 "GB00525037" 57452.539 99843.185 .033957053 "GB00267687" 358815 382742 .09622508 20 2004 1 "GB03116767" 193504 369954 .08858215 "GB00387583" 45737 123116 .18761615 37 2004 1 "GB03402476" 42987.397 22614.217 .1508552 "GB00387583" 45737 123116 .18761615 37 2004 1 "GB00832994" 35849 126652 .20430137 "GB00631367" 22019 15660 .11253917 73 2004 1 "GB03621275" 18453 34699 .14003143 "GB00631367" 22019 15660 .11253917 73 2004 1 "GB04460555" 18966 4842 .09464305 "GB00631367" 22019 15660 .11253917 73 2004 1 "GB04155758" 13747 . .0800902 "GB00631367" 22019 15660 .11253917 73 2004 1 "GB03218561" 15461 60153 .13155682 "GB00631367" 22019 15660 .11253917 73 2004 1 "GB03261230" 13408.216 . .15516904 "GB00654833" 31898 18106 .05940811 30 2004 1 "GB04335352" 43889 81443 .0440885 "GB00654833" 31898 18106 .05940811 30 2004 1 "GBSC006445" 20271.735 31343.119 .0592711 "GB00654833" 31898 18106 .05940811 30 2004 1 "GB02482190" 29124.356 36592.476 .0760808 "GB00654833" 31898 18106 .05940811 30 2004 1 "GB00207104" 18831 22193 .08735596 "GB00654833" 31898 18106 .05940811 30 2004 1 "GB00192795" 21226 26975 .06374258 "GB00840256" 6766.074 16173.085 .10354128 20 2004 1 "GB00681381" 8553.579 5090.011 .07008423 "GB00840256" 6766.074 16173.085 .10354128 20 2004 1 "GB03833628" 3620.99 10244.753 .09089144 "GB00840256" 6766.074 16173.085 .10354128 20 2004 1 "GB00447327" 8393.428 20248.392 .1052384 "GB00840256" 6766.074 16173.085 .10354128 20 2004 1 "GB00393664" 4743.14 . .10802022 "GB00840256" 6766.074 16173.085 .10354128 20 2004 1 "GB03269504" 7139.06 19904.502 .13843377 "GB00905173" 87325 41476 .0190209 39 2004 1 "GB03171339" 106746 104764 .028460084 "GB00905173" 87325 41476 .0190209 39 2004 1 "GB02341071" 122365 433775 .02338087 "GB00905173" 87325 41476 .0190209 39 2004 1 "GB01908318" 60673 87716 .015064362 "GB00905173" 87325 41476 .0190209 39 2004 1 "GB02096650" 91487 . .018406987 "GB00905173" 87325 41476 .0190209 39 2004 1 "GB00955278" 84568 57111 .012829912 "GB01196432" 47125 70092 .14501856 39 2004 1 "GBSC041400" 29474 31361 .1152202 "GB01196432" 47125 70092 .14501856 39 2004 1 "GB00748096" 55560.796 116065.688 .1827216 "GB01196432" 47125 70092 .14501856 39 2004 1 "GB01326515" 38167 25547 .14082846 "GB01196432" 47125 70092 .14501856 39 2004 1 "GB04545813" 42418 66379 .1212457 "GB01196432" 47125 70092 .14501856 39 2004 1 "GB01368806" 35649 57869 .15346853 "GB01204488" 81021 211733 .11531578 50 2004 1 "GB02517475" 42148 50199 .0787226 "GB01204488" 81021 211733 .11531578 50 2004 1 "GBFC015087" 44488.87 69801.281 .11406557 "GB01204488" 81021 211733 .11531578 50 2004 1 "IE111622" 42288.155926744 42998.0697761627 .08071145 "GB01204488" 81021 211733 .11531578 50 2004 1 "GB00699993" 42900 94274 .13573426 "GB01204488" 81021 211733 .11531578 50 2004 1 "GB00939600" 55343 48896 .13712664 "GB01226337" 7664 27483 .4382829 73 2004 1 "IE176399" 4116.8601819017 1623.40023220067 .3215476 "GB01226337" 7664 27483 .4382829 73 2004 1 "GB04355170" 4555.816 11525.663 .3216148 "GB01226337" 7664 27483 .4382829 73 2004 1 "GB03714989" 5751.46 6853.285 .5961735 "GB01226337" 7664 27483 .4382829 73 2004 1 "GB03483526" 6456.188 11037.504 .4744094 "GB01226337" 7664 27483 .4382829 73 2004 1 "IE129629" 9254.00462608067 24252.0450057667 .3480921 "GB01264385" 38604 99146 .3178945 59 2004 1 "GB04414510" 34253.716 48949.549 .2186402 "GB01264385" 38604 99146 .3178945 59 2004 1 "IE903862" 36226.2604218591 80248.0215978612 .4257513 "GB01281596" 33640 37486 .1637039 34 2004 1 "GB00210138" 33906 26965 .1934466 "GB01281596" 33640 37486 .1637039 34 2004 1 "IE079512" 31218.9367780914 30443.7809724364 .1290189 "GB01281596" 33640 37486 .1637039 34 2004 1 "GB01152723" 21732 69853 .16570035 "GB01281596" 33640 37486 .1637039 34 2004 1 "IE037769" 18182.845720805 . .12519935 "GB01281596" 33640 37486 .1637039 34 2004 1 "GB00263995" 17342 43776 .17183715 "GB01378507" 1777.131 . .0455335 39 2004 1 "GB02335628" 1903.955 1985.352 .04223944 "GB01378507" 1777.131 . .0455335 39 2004 1 "GB02937377" 2259.075 5132.254 .04574881 "GB01378507" 1777.131 . .0455335 39 2004 1 "GB03513384" 1016.237 373.587 .04013631 "GB01378507" 1777.131 . .0455335 39 2004 1 "GB00765118" 2636 . .066388465 "GB01378507" 1777.131 . .0455335 39 2004 1 "GB03150434" 2108.886 4520.15 .05945319 "GB01577740" 12756.588 39158.271 .2194861 56 2004 1 "GBSC115728" 15867.137 66701.667 .1758488 "GB01577740" 12756.588 39158.271 .2194861 56 2004 1 "GB01984976" 12699.201 58736.46 .1754157 "GB01577740" 12756.588 39158.271 .2194861 56 2004 1 "GB01275815" 7459.281 25158.322 .152358 "GB01618428" 310751 564760 .14440823 56 2004 1 "GB00162636" 207589 278295 .20035744 "GB01618428" 310751 564760 .14440823 56 2004 1 "GB00453448" 307346 562677 .14854269 "GB01618428" 310751 564760 .14440823 56 2004 1 "GB01098034" 161224.15 229141.506 .1641763 "GB01672034" 11376.138 17754.446 .11796464 50 2004 1 "GB00188491" 6501.372 13625.748 .10006934 "GB01672034" 11376.138 17754.446 .11796464 50 2004 1 "GB01371982" 5881.632 . .17070177 "GB01672034" 11376.138 17754.446 .11796464 50 2004 1 "GB01418418" 7323.264 5302.979 .09178749 "GB01672034" 11376.138 17754.446 .11796464 50 2004 1 "GB02277210" 10815 15822 .10226537 "GB01672034" 11376.138 17754.446 .11796464 50 2004 1 "IE039851" 15930.5486794 . .09647107 "GB01720832" 19247.646 54722.509 .104993 59 2004 1 "GB02943795" 11089 8900 .08287492 "GB01720832" 19247.646 54722.509 .104993 59 2004 1 "GB02339902" 26299.682 53004.8 .1288408 "GB01720832" 19247.646 54722.509 .104993 59 2004 1 "GB03007166" 18260 44719 .11675794 "GB01720832" 19247.646 54722.509 .104993 59 2004 1 "GB01257379" 27511.406 39684.187 .09147736 "GB01720832" 19247.646 54722.509 .104993 59 2004 1 "GBSC045382" 11493.307 4335.496 .14361507 "GB01806531" 9985 28324 .01752629 73 2004 1 "GB03333570" 5582.575 10992.627 .019616755 "GB01806531" 9985 28324 .01752629 73 2004 1 "GB02657165" 9152.552 20522.701 .025346264 "GB01806531" 9985 28324 .01752629 73 2004 1 "GB03873327" 5554.391 9385.344 .018202895 "GB01806531" 9985 28324 .01752629 73 2004 1 "GB01643277" 5763.803 15276.752 .014823893 "GB01806531" 9985 28324 .01752629 73 2004 1 "GB03693534" 13030.413 11277.185 .016857486 "GB01898700" 15275.636 9992.675 .08285265 30 2004 1 "GB00737856" 8410 6137 .08787158 "GB01898700" 15275.636 9992.675 .08285265 30 2004 1 "GBSC006445" 20271.735 31343.119 .0592711 "GB01898700" 15275.636 9992.675 .08285265 30 2004 1 "GB01643349" 8808.185 . .05674529 "GB01898700" 15275.636 9992.675 .08285265 30 2004 1 "GB01144080" 14903 21628 .06582567 "GB01898700" 15275.636 9992.675 .08285265 30 2004 1 "GB02228238" 10011 13100 .09659375 "GB02119266" 56382 143795 .05904367 73 2004 1 "GB01334654" 49738 22520 .07443001 "GB02119266" 56382 143795 .05904367 73 2004 1 "GB00593047" 76550 6235 .04306989 "GB02119266" 56382 143795 .05904367 73 2004 1 "GB03193472" 35447.772 . .05269815 "GB02119266" 56382 143795 .05904367 73 2004 1 "GB00949387" 51942 58335 .08291941 "GB02119266" 56382 143795 .05904367 73 2004 1 "GB02189907" 55174 135702 .07757277 "GB02147328" 3563.222 7316.586 .3107859 80 2004 1 "GB03751484" 2769.545 4730.133 .3047865 "GB02147328" 3563.222 7316.586 .3107859 80 2004 1 "GBSC129114" 3558.47 . .2126144 "GB02147328" 3563.222 7316.586 .3107859 80 2004 1 "GB01850502" 2268.344 1760.018 .2604812 "GB02147328" 3563.222 7316.586 .3107859 80 2004 1 "GB03908160" 2236.735 . .3109184 "GB02147328" 3563.222 7316.586 .3107859 80 2004 1 "GB03191679" 4399.705 1684.079 .3165603 "GB02183896" 13609 31335 .26115072 39 2004 1 "GB02664025" 7083 . .2099393 "GB02183896" 13609 31335 .26115072 39 2004 1 "GB02175448" 10227.648 16858.959 .2115678 "GB02183896" 13609 31335 .26115072 39 2004 1 "GB00907700" 8602.027 16469.252 .20080255 "GB02183896" 13609 31335 .26115072 39 2004 1 "GB01851035" 7754.62 17724.544 .17505217 "GB02183896" 13609 31335 .26115072 39 2004 1 "GB02777148" 14252.085 92835.122 .18776123 "GB02402927" 55316.81 102427.55 .12333365 42 2004 1 "GB01544410" 44730.42 113643.808 .13607295 "GB02402927" 55316.81 102427.55 .12333365 42 2004 1 "GB01398125" 57829 111818 .09432983 "GB02464026" 8005.863 9590.878 .04569126 42 2004 1 "GB04021759" 4883.842 . .04925651 "GB02464026" 8005.863 9590.878 .04569126 42 2004 1 "GB04191476" 4911.104 10861.959 .04670742 "GB02464026" 8005.863 9590.878 .04569126 42 2004 1 "GB01194193" 4467.425 13420.005 .06181346 end
Please note that it is panel data I am working with, however there is currently no 'time' variable in the matched data set for each cross-sectional unit - there is only one year of data for each firm ID. This is due to the fact I was matching on a different year of data for each individual treated firm. (in my original, larger data set I have the full panel data of all firm IDs and years with all variables and plan to merge the two once I have successfully reshaped the current matched data.
I would like to reshape the data into a panel so as to be able to merge this matched sample with my other data set which contains all years and variables for all matched firm IDs. Importantly, I would still like to be able to identify to which treated firm ID each control firm ID is matched, as it is important in my data set to know the corresponding treated firm ID's DealYear for each control firm ID.
The end goal for estimation is to run a difference-in-differences model on treated and control firms.
I realize this may sound quite awkward and clumsy, but I do hope it makes sense.
Any advice or direction is greatly appreciated,
Paul
0 Response to Reshaping matched panel data
Post a Comment