Dear all,

I have panel data of funds where one type of fund has received a "treatment" and the "conventional" fund has not received this treatment. I would like to construct matched pairs where I match "treated" funds with "conventional" funds based on specific characteristics. More specifically I would like to match funds on the following matching criteria:

(1) Category classification → These need to be exact matches, both the "treated" and "conventional" fund need to have the same category

(2) Fund age → I would like to match funds based on age, the age of the "treated" and "conventional" fund may not deviate more than one year from each other. In the case that this does not result in any matches I would like to relax this assumption to a maximum deviation of three years

(3) Fund size → Finally I would like to select four "conventional" funds for each "treated" fund based on fund size, these four funds need to be the closest in fund size relative to the "treated" fund (as I have read that this variable cannot change over time in order to properly match, I have created a fixed fund size variable "fund_size_fixed")


I would like that all the three criteria are applied for the matching procedure, which procedure can I use best in order to create these matched pairs? Eventually I would like to run a separate regression for the "treated" and "conventional" funds to compare returns (after the matching).

Below I provide a sample of the data, where "newId" represents a fund and the variable "treat" has the value 1 for funds that were treated and the value 0 for conventional funds.

Any help or suggestions on how to construct these matched pairs would be very much appreciated.

(Stata version I'm using: 16.1)

Kind regards,

Rudolf


Code:
* Example generated by -dataex-. For more info, type help dataex
clear
input float(newid year month week) str39 Category double(Fundsize returns) byte age float(Fund_size_fixed treat)
 1 2019 1 3072 "Global Emerging Markets Equity"     96050477     .02586004629925842  9    160371424 0
 1 2019 2 3074 "Global Emerging Markets Equity"     94754079    .002809418036753719  9    160371424 0
 1 2019 1 3068 "Global Emerging Markets Equity"    140927914    .013890484860078711  9    160371424 0
 1 2019 2 3076 "Global Emerging Markets Equity"     96721740   -.014101777203178623  9    160371424 0
 1 2019 3 3077 "Global Emerging Markets Equity"     97016300  -.0064262073719874024  9    160371424 0
 1 2019 2 3073 "Global Emerging Markets Equity"     94510531    -.01603636227082461  9    160371424 0
 1 2019 2 3075 "Global Emerging Markets Equity"     97859140    .026713215062045492  9    160371424 0
 1 2019 1 3071 "Global Emerging Markets Equity"     95713288    .007914217305369675  9    160371424 0
 1 2019 1 3069 "Global Emerging Markets Equity"    143057404    .016743448992764698  9    160371424 0
 1 2019 1 3070 "Global Emerging Markets Equity"     94262645     .02377922997726145  9    160371424 0
 2 2019 2 3074 "US Equity Large Cap Growth"        602491976    .018315543229609172 15    705565184 0
 2 2019 1 3069 "US Equity Large Cap Growth"        571509856    .006733695510774851 15    705565184 0
 2 2019 1 3071 "US Equity Large Cap Growth"        580574752   -.006438652519136667 15    705565184 0
 2 2019 1 3070 "US Equity Large Cap Growth"        585754140    .028813755050079475 15    705565184 0
 2 2019 3 3077 "US Equity Large Cap Growth"        600016808  -.0017452694786091645 15    705565184 0
 2 2019 1 3072 "US Equity Large Cap Growth"        601463748     .03637902702515324 15    705565184 0
 2 2019 2 3073 "US Equity Large Cap Growth"        597925064  -.0032990390706496933 15    705565184 0
 2 2019 2 3075 "US Equity Large Cap Growth"        602128552    .012189860631577787 15    705565184 0
 2 2019 2 3076 "US Equity Large Cap Growth"        601720140 -.00032384061099340517 15    705565184 0
 2 2019 1 3068 "US Equity Large Cap Growth"        568301760    .020751451928438153 15    705565184 0
 3 2019 2 3076 "Infrastructure Sector Equity"     1022859648    .005685754353180528  9    946288192 0
 3 2019 2 3074 "Infrastructure Sector Equity"     1014968960    .013801898062688167  9    946288192 0
 3 2019 1 3071 "Infrastructure Sector Equity"      902528400    .005279046716168523  9    946288192 0
 3 2019 1 3070 "Infrastructure Sector Equity"      904514176    .018177215041394135  9    946288192 0
 3 2019 1 3069 "Infrastructure Sector Equity"      890947328    .014403823297470808  9    946288192 0
 3 2019 2 3073 "Infrastructure Sector Equity"      911453376   -.003233547146123783  9    946288192 0
 3 2019 3 3077 "Infrastructure Sector Equity"     1023260656    .005685660520368785  9    946288192 0
 3 2019 1 3072 "Infrastructure Sector Equity"      919798048    .024011038256421813  9    946288192 0
 3 2019 1 3068 "Infrastructure Sector Equity"      880622768     .02089705633211203  9    946288192 0
 3 2019 2 3075 "Infrastructure Sector Equity"     1022164736    .011124981916509569  9    946288192 0
 4 2019 2 3073 "Global Emerging Markets Equity"    487844104    -.01213187324659278  8    809371520 0
 4 2019 3 3077 "Global Emerging Markets Equity"    508599105  -.0054128640331327915  8    809371520 0
 4 2019 2 3074 "Global Emerging Markets Equity"    494504512    .001334315186903486  8    809371520 0
 4 2019 1 3072 "Global Emerging Markets Equity"    492003394    .022517106202273023  8    809371520 0
 4 2019 2 3075 "Global Emerging Markets Equity"    517496436     .02436269352297297  8    809371520 0
 4 2019 1 3069 "Global Emerging Markets Equity"    458075087    .011877523548503058  8    809371520 0
 4 2019 1 3068 "Global Emerging Markets Equity"    447294459    .010406062172970168  8    809371520 0
 4 2019 1 3070 "Global Emerging Markets Equity"    473372353    .026057611396582175  8    809371520 0
 4 2019 1 3071 "Global Emerging Markets Equity"    476691025    -.00586543814279139  8    809371520 0
 4 2019 2 3076 "Global Emerging Markets Equity"    509606762    -.01137991575524211  8    809371520 0
 5 2019 3 3077 "US Equity Large Cap Blend"          79850000  -.0030822647968307137  5    121588848 1
 5 2019 1 3072 "US Equity Large Cap Blend"          77994256    .031240394804626703  5    121588848 1
 5 2019 2 3075 "US Equity Large Cap Blend"          80194928    .008347364433575422  5    121588848 1
 5 2019 1 3068 "US Equity Large Cap Blend"          70326152    .030648610508929863  5    121588848 1
 5 2019 1 3070 "US Equity Large Cap Blend"          74881072     .03596676846781399  5    121588848 1
 5 2019 1 3071 "US Equity Large Cap Blend"          75606992    .005697263637557626  5    121588848 1
 5 2019 1 3069 "US Equity Large Cap Blend"          72069328     .02133316546678543  5    121588848 1
 5 2019 2 3073 "US Equity Large Cap Blend"          76877056    -.01441269191577188  5    121588848 1
 5 2019 2 3074 "US Equity Large Cap Blend"          79150352    .029830563765838036  5    121588848 1
 5 2019 2 3076 "US Equity Large Cap Blend"          79911488  .00014669005759060383  5    121588848 1
 6 2019 1 3068 "US Equity Small Cap"                27046865    .021363029027321012  3    171373728 1
 6 2019 1 3069 "US Equity Small Cap"                27247785    .022986635262993715  3    171373728 1
 6 2019 1 3071 "US Equity Small Cap"                29220300   .0011523314751684666  3    171373728 1
 6 2019 2 3076 "US Equity Small Cap"                34550225  -.0007380175288791389  3    171373728 1
 6 2019 3 3077 "US Equity Small Cap"                34990810  -.0032350778055842966  3    171373728 1
 6 2019 2 3073 "US Equity Small Cap"                31594275    .011587621935177594  3    171373728 1
 6 2019 1 3070 "US Equity Small Cap"                28675220    .038762275461301954  3    171373728 1
 6 2019 1 3072 "US Equity Small Cap"                31132356     .03998212516307831  3    171373728 1
 6 2019 2 3074 "US Equity Small Cap"                32921630      .0278822518312265  3    171373728 1
 6 2019 2 3075 "US Equity Small Cap"                34402435    .010216929871171843  3    171373728 1
 7 2019 1 3072 "US Equity Mid Cap"                 849578572    .026121724707384903 37    931573120 0
 7 2019 2 3073 "US Equity Mid Cap"                         .  -.0044741063805607455 37    931573120 0
 7 2019 1 3069 "US Equity Mid Cap"                         .    .023703488637693226 37    931573120 0
 7 2019 1 3068 "US Equity Mid Cap"                         .     .03758999462157845 37    931573120 0
 7 2019 1 3071 "US Equity Mid Cap"                         .   .0069949678775376905 37    931573120 0
 7 2019 2 3074 "US Equity Mid Cap"                         .    .025862491228025197 37    931573120 0
 7 2019 2 3075 "US Equity Mid Cap"                         .     .00799412780907005 37    931573120 0
 7 2019 2 3076 "US Equity Mid Cap"                 859782164 -.00004400615580379963 37    931573120 0
 7 2019 1 3070 "US Equity Mid Cap"                         .     .03002557067125104 37    931573120 0
 7 2019 3 3077 "US Equity Mid Cap"                         .   -.002852885731651137 37    931573120 0
 8 2019 2 3073 "US Equity Large Cap Blend"                 .   -.004806196899153292  9 2.921957e+11 0
 8 2019 1 3071 "US Equity Large Cap Blend"                 .   -.009889973909594119  9 2.921957e+11 0
 8 2019 2 3074 "US Equity Large Cap Blend"                 .     .02464785530739455  9 2.921957e+11 0
 8 2019 3 3077 "US Equity Large Cap Blend"                 .  -.0029232650995254517  9 2.921957e+11 0
 8 2019 1 3069 "US Equity Large Cap Blend"                 .    .013419888578937389  9 2.921957e+11 0
 8 2019 1 3072 "US Equity Large Cap Blend"      170821828608    .030813884804956615  9 2.921957e+11 0
 8 2019 1 3070 "US Equity Large Cap Blend"                 .     .03389974003892249  9 2.921957e+11 0
 8 2019 1 3068 "US Equity Large Cap Blend"                 .     .01809547981636328  9 2.921957e+11 0
 8 2019 2 3075 "US Equity Large Cap Blend"                 .    .007962974603287876  9 2.921957e+11 0
 8 2019 2 3076 "US Equity Large Cap Blend"      179240206336  -.0005815500917378813  9 2.921957e+11 0
 9 2019 1 3071 "US Equity Large Cap Growth"                .   -.013116839591255314 62   3354400768 0
 9 2019 1 3068 "US Equity Large Cap Growth"                .     .02093141842183499 62   3354400768 0
 9 2019 2 3075 "US Equity Large Cap Growth"                .    .008909669377317186 62   3354400768 0
 9 2019 1 3072 "US Equity Large Cap Growth"       1761966336     .03680766257457435 62   3354400768 0
 9 2019 1 3070 "US Equity Large Cap Growth"                .     .03943107717876826 62   3354400768 0
 9 2019 2 3074 "US Equity Large Cap Growth"                .    .025664021561839334 62   3354400768 0
 9 2019 2 3073 "US Equity Large Cap Growth"                .   -.008511923777405173 62   3354400768 0
 9 2019 2 3076 "US Equity Large Cap Growth"       1809414144   -.004125958992517553 62   3354400768 0
 9 2019 1 3069 "US Equity Large Cap Growth"                .    .013731814688071609 62   3354400768 0
 9 2019 3 3077 "US Equity Large Cap Growth"                .   -.001630956365261227 62   3354400768 0
10 2019 3 3077 "Global Emerging Markets Equity"    874676926  .00008340342901647091 26    783772672 0
10 2019 1 3069 "Global Emerging Markets Equity"    852975557    .020031620268210187 26    783772672 0
10 2019 2 3075 "Global Emerging Markets Equity"    917119897    .029457795394894976 26    783772672 0
10 2019 2 3074 "Global Emerging Markets Equity"    891294159   .0023904918033486786 26    783772672 0
10 2019 1 3072 "Global Emerging Markets Equity"    909941604     .03332240367308259 26    783772672 0
10 2019 1 3070 "Global Emerging Markets Equity"    879928233    .031507518053960716 26    783772672 0
10 2019 1 3071 "Global Emerging Markets Equity"    881691655    .004985104004542033 26    783772672 0
10 2019 2 3076 "Global Emerging Markets Equity"    876719581   -.014524635082731644 26    783772672 0
10 2019 2 3073 "Global Emerging Markets Equity"    889509904   -.015821367832055937 26    783772672 0
10 2019 1 3068 "Global Emerging Markets Equity"    838304906    .020554022113646066 26    783772672 0
end
format %tw week