Hello community,
I have unbalanced panel data.
I need to do propensity score matching for each year separately.
I want to do two nearest neighbor matching with replacement.
I want to do it using a loop in Stata 14, how can I do that?
I tried using this code but didn't work
Could you please give me suggestions on how I can do this in an efficient way? otherwise, i will have to do it manually and divide the data file into smaller files by year and do it manually for each year, which could take long because I have around 30 years in my data.
Thank you.
I have unbalanced panel data.
I need to do propensity score matching for each year separately.
I want to do two nearest neighbor matching with replacement.
I want to do it using a loop in Stata 14, how can I do that?
I tried using this code but didn't work
Code:
levelsof year, local(years) foreach year in `years' { qui keep if year = `year' qui psmatch2 vc_backing wtoas age i.ctryiso_num i.main_industry, logit outcome(matched_data`year' pre_vc) neighbor(2) }
Thank you.
Comment