Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to properly construct the matched data (via propensity score matching) for DID

    Hello, I want to employ DiD with Propensity Score Matching to conduct the impact analysis for a policy implemented in 1998.
    My original firm-level data before matching is given as below:

    For matching, I tried the following:
    Code:
    drop if year >= 1997
    probit treated1 ln_asset ln_ebit ln_l ln_k
    predict pscore
    psmatch2 treated1 ln_asset ln_ebit ln_l ln_k, outcome(lshare1) noreplacement com cal(0.1)
    gen pair = _id if _treated==0 
    replace pair = _n1 if _treated==1
    label var pair "psmatch2 id of pairs"
    bysort pair: egen paircount = count(pair)
    drop if paircount !=2
    drop paircount _nn _id _n1
    
    sort uniqueid year
    save "matched.dta", replace
    
    merge 1:1 uniqueid year using "original.dta"
    keep if _merge == 3
    In this way, I lose all the post treatment periods, which is the main problem.
    Could you help me with how to merge a complete set of dataset for DiD with matched data with both pre- and post-treatment periods?


    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input float(uniqueid year treated1 postreform) byte ksic2c float(hhi_sales lshare1 ln_y ln_k ln_l)
    1 1991 0 0 21  .05181734  .4897  23.96307 23.431915  6.861712
    1 1992 0 0 21  .05352982  .4364 24.189575  23.73835  6.887553
    1 1993 0 0 21  .05338813  .4415    24.288  23.83263  6.884487
    1 1994 0 0 21   .0517649  .4982 24.260313  24.02132  6.925595
    1 1995 0 0 21   .0512402  .4797  24.43424  24.12565  6.891626
    1 1996 0 0 21  .05364646  .4948  24.49408 24.197716  6.877296
    1 1997 0 0 21 .071214095  .5006  24.58821 23.570583  6.877296
    1 1998 0 1 21  .07117989  .4273  24.63981   24.2849  6.811244
    1 1999 0 1 21  .07088037  .2614 24.971994 24.308714  6.684612
    1 2000 0 1 21  .06271941  .8539  23.83033  24.40697   6.60665
    1 2001 0 1 21    .055039   .556 24.485575  24.43152  6.638568
    1 2002 0 1 21  .05649804  .5746  24.59655 24.464577  6.719013
    1 2003 0 1 21  .05231318  .6055  24.62833    24.479  6.736967
    1 2004 0 1 21  .05077323  .6867 24.570116  24.51651  6.694562
    1 2005 0 1 21  .05311356  .5684  24.24638  24.55461  6.687109
    1 2006 0 1 21  .05217143  .6056  24.36541  24.61615  6.708084
    1 2007 0 1 21  .05387806  .6112 24.409815  24.66132  6.719013
    1 2008 0 1 21  .05611051  .4473 24.828297 24.682966  6.747587
    1 2009 0 1 21  .05811165  .4235  25.02365 24.699453  6.791222
    1 2010 0 1 21   .0560264  .5767  24.86954 25.856627  6.700731
    1 2011 0 1 21  .05059672  .5075 24.957836  25.90188  6.697034
    2 1991 1 0 31   .4213557  .5093  23.51501 23.618286  6.692084
    2 1992 1 0 31  .48241925  .5819  23.54186  23.73416  6.704414
    2 1993 1 0 31  .48116615  .5178 23.475424  23.72624  6.098074
    2 1994 1 0 31  .50073665  .6232  22.88424  23.50243  5.666427
    2 1995 1 0 31   .5155886  .7512  20.85182    23.499  5.236442
    2 1996 1 0 31  .49643224   .414  24.24684  24.96295  6.755769
    2 1998 1 1 31   .4526372   .621  23.39155  25.00756  6.309918
    2 2001 1 1 31   .2890171  .8521  23.21854  24.43679  6.161207
    2 2002 1 1 31  .29551533  .1577  25.22541 24.481195  6.033086
    2 2003 1 1 31  .27689195  .4164 24.090836  24.53496  5.993961
    2 2005 1 1 31  .27040976  .2975  23.03234  24.59965  6.228511
    2 2006 1 1 31  .27439922  .8709 22.373573  24.68687  6.204558
    2 2007 1 1 31  .27405494  .2167  24.02231  24.60003  5.955837
    2 2008 1 1 31  .28495467 1.3297  21.64143 24.623646  5.894403
    2 2010 1 1 31   .2815831   .163 23.254734  24.68772  5.616771
    2 2011 1 1 31   .3801102  .2409  22.92732 24.591793  5.575949
    3 1991 0 0 47   .3354113  .6514 24.341873  25.25339  7.665753
    3 1992 0 0 47  .34448385  .6793 24.276983 25.277357  7.597898
    3 1993 0 0 47   .3559043  .7178 24.221666 25.326374  7.561642
    3 1994 0 0 47   .3546242  .5764 24.515373   25.8834  7.580189
    3 1995 0 0 47   .3592656  .5844 24.656904  25.90187  7.523481
    3 1996 0 0 47   .3725042  .6432  24.53554  25.96245  7.441907
    3 1997 0 0 47   .3836862  .5627   24.6562  25.91032  7.403061
    3 1998 0 1 47   .3867261  .4604  24.79266  25.91152  7.428333
    3 1999 0 1 47   .3996449  .5143 24.914743   25.9185  7.428333
    3 2000 0 1 47  .33890685  .5777 24.857914  25.73189  7.342779
    3 2001 0 1 47  .35462224  .6374  24.58293    25.729  7.265429
    3 2002 0 1 47   .3785505   .551  24.82188 25.741364  7.290293
    3 2003 0 1 47   .3876458  .6876   24.6553  25.74615  7.034388
    3 2004 0 1 47  .40490225  .4178 23.212496 25.738005  7.013016
    3 2005 0 1 47   .4127032  .1305  24.25599  25.74296   6.96319
    3 2007 0 1 47   .4149574  .0746 25.330914  25.69178  6.790097
    3 2009 0 1 47   .4066013  .1152 24.347645 27.203924   6.36647
    3 2010 0 1 47   .4055971  .0626  24.98158  27.21099  6.284134
    3 2011 0 1 47  .56482244   .086  24.43714 25.662464  6.385194
    4 1991 0 0 71  .07956681  .3813   26.0167 26.762653  8.295548
    4 1992 0 0 71   .0786362  .4794  25.95025 26.871416  8.250359
    4 1993 0 0 71  .07177163  .4826 25.891724 27.022476  8.230044
    4 1994 0 0 71  .07273845  .5245 25.830635  27.25725  8.209309
    4 1995 0 0 71  .07342871  .4993 26.233444  27.39054  8.167352
    4 1996 0 0 71 .072934516  .5574  26.03198  27.40442 8.1847925
    4 1997 0 0 71   .0781921  .4979 26.245274  27.45299  7.988882
    4 1998 0 1 71  .07776387  .3591 26.248676 27.372503  7.935945
    4 1999 0 1 71  .07633055  .3336 26.288864  27.38952  7.806289
    4 2000 0 1 71  .07649403  .3717 26.308447 27.410067  7.767264
    4 2001 0 1 71 .068164214  .3247 26.244555  26.23344  7.082549
    4 2002 0 1 71 .067267805  .3011  26.00619  26.29709  7.102499
    4 2003 0 1 71 .073163316  .3953  25.76795 26.386675  7.082549
    4 2004 0 1 71   .0745528  .2468  25.72853  26.43069  7.118826
    4 2005 0 1 71 .071113676  .2641  25.79058  26.47537  7.154615
    4 2006 0 1 71  .07161281  .3372 25.542967  26.55257  7.132498
    4 2007 0 1 71  .07922857  .3959  25.32298  26.59785  7.081708
    4 2008 0 1 71  .12331319  1.656 22.990234     26.64  7.096721
    4 2009 0 1 71    .104891   .232  25.93053 26.667366  7.074963
    4 2010 0 1 71  .09211212  .1768  26.10226 26.703707   7.06732
    4 2011 0 1 71  .10922042  .0841   25.3756 22.850906  5.135798
    5 1991 1 0 11   .5145179  .3402 25.092907 24.887163  7.467942
    5 1992 1 0 11   .5063352  .5111 24.785185 25.157526  7.511525
    5 1993 1 0 11   .4772263  .4148  25.13526 25.329826  7.501082
    5 1994 1 0 11    .484674  .3457 25.403194 25.788897  7.627544
    5 1995 1 0 11   .4526424  .4394  25.52822  25.86832   7.64874
    5 1996 1 0 11   .4169289  .4654  25.59211 25.928566  7.699389
    5 1997 1 0 11   .4172299  .3858 25.712555 25.899134  7.596894
    5 1998 1 1 11    .406155  .2884  25.81511  25.92809  7.504392
    5 1999 1 1 11   .3698842  .2843 25.918396 25.915674  7.418781
    5 2000 1 1 11   .4236287  .1593 26.647585 26.037374  7.567863
    5 2001 1 1 11   .4423804   .454  25.84178  26.04502  7.648263
    5 2002 1 1 11   .4422717  .6478  25.58613 26.165104   7.60589
    5 2009 1 1 11   .4075448  .2534 26.251715  26.52544  7.373374
    5 2010 1 1 11   .4097762  .3394  26.20202  26.55831  7.366445
    5 2011 1 1 11    .444746  .3654 26.318483  28.21211  8.131236
    6 1991 0 0 21  .05181734   .669  24.20566 23.935875  7.337588
    6 1992 0 0 21  .05352982  .6757 24.288904  24.07287  7.338888
    6 1993 0 0 21  .05338813  .6775 24.334217 24.136194  7.312553
    6 1994 0 0 21   .0517649   .701 24.371475  24.19478  7.273093
    6 1995 0 0 21   .0512402  .6769 24.532085 24.280895  7.257003
    6 1996 0 0 21  .05364646  .7363 24.456446 24.355743   7.26333
    6 1997 0 0 21 .071214095  .6192 24.613295  25.07311  7.161622
    6 1998 0 1 21  .07117989  .3821 24.895733 25.081173  7.028202
    end
Working...
X