东盟8 发表于 2019-2-15 16:36 
求大神帮帮忙,不甚感激!
//**以下是均值分组y差异性检验
egen x_mean = mean(x)
gen port=0
replace port = 1 if x>=x_mean
ttest y if port==0 | port==1, by(port)
//**以下是中位数分组y差异性检验
cumul(x), gen(port) eq
recode port (min/0.5=0)(0.5/max=1)
ttest y if port==0 | port==1, by(port)