Announcement

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

  • Identifying matched cases after nearest neighbor maching

    I used to the following codes to obtain matched dataset. However it only says "matched" as a whole and I am not sure how to specifically identify matched pairs (for example, a specific case is matched to which case).


    Can anyone please help me? Thank you very much.


    gen obsnum = _n

    preserve

    teffects nnmatch (DV IVs) (treatment), gen(newvar)

    stack newvar*, into(obsnum) clear

    bys obsnum: keep if _n==1

    tempfile matched

    save `matched'

    restore

    merge 1:1 obsnum using `matched', keepus(obsnum)
    Last edited by April Kimm; 29 Apr 2022, 03:23.
Working...
X