I am using the code below for the nearest matching but I am struggling with obtaining a matched dataset for further analyses. I used the following commands but it did not work. Can anyone please help me?
teffects nnmatch (DV IVs) (treatment_variable), generate (newvar)
gen obsnum = _n
keep newvar*
stack newvar*, into(obsnum) clear
drop _stack
bysort obsnum: keep if (_n == 1)
gen byte in_sample = 1
tempfile matchsample
save `matchsample'
Comment