下面是我按照1对1进行匹配对照组的命令,请问需要如何改动才能进行1:3的比例选取对照组?
另外,如果对照组中出现了相同的样本应该怎么办?是否需要进行删除?
use shiyan,clear
local N=_N
mkmat code year indcd totass, mat(shiyan)
capture postclose match
postfile match code year wt match_group using mymatch,replace
forval i=1(1)`N' {
di "`i' of `N' loops completed"
drop _all
use duizhao.dta
qui keep if year==scalar(shiyan[`i',2])
qui keep if indcd==scalar(shiyan[`i',3])
gen assetratio=abs(totass/scalar(shiyan[`i',4])-1)
qui keep if assetratio<0.2
if _N<1{
continue
}
gen distance=assetratio^2
sort distance code
qui keep if _n==1
local code1=scalar(shiyan[`i',1])
local year1=scalar(shiyan[`i',2])
local code2=code[1]
local year2=year[1]
post match (`code1') (`year1') (1) (`i')
post match (`code2') (`year2') (0) (`i')
//postfile match code year wt match_group using mymatch,replace
}
postclose match
use mymatch,clear