Quantcast
Channel: Statalist
Viewing all articles
Browse latest Browse all 72776

Merge treated and control - my code works but has dupilicates

$
0
0
Dear Statalisters,

I attached my data (stata13). If you need other formats, let me know.

You will find 17 treated firms
:
tab _treated
you will find 17 treated, out of 1418 , 17 are matched.

_id identifies the treated firms
_n1 identifies the nearest neighbor matched to treated firms

gvkey is the unique identifier.


I want a output that keeps 17 treated and its matches.

I had an earlier post
http://www.statalist.org/forums/foru...-a-index-value




:
use full,clear
drop if missing(_n1)
drop treated1975
rename _id _id1
rename _n1 _id2
generate dummy = _n
reshape long _id, i(dummy) j(j)
drop dummy j

merge 1:1 _id using treated1975, keep(matched)
drop _merge
save mergeddata,replace

it works well there, thanks to William !!!

but now, I run the same code on the attached data, I got duplicates in gvkey , can you help?

Regards,
Rochelle

Viewing all articles
Browse latest Browse all 72776

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>