如题。本人想根据受教育年数分别作回归 受教育年数一共是17年 运气比较好 万一是50年呢 那我气不死要弄50个回归。。。想想都可怕,此外,做完每一个回归后,保存suppins变量的系数,并赋值到b0变量中,也就是有17个suppins系数值。这一步我怎么循环都无法实现 无奈使用最老土的方式实现的,我的stata命令如下:
quietly regress ltotexp suppins phylim actlim totchr age female income if educyr==0
gen b0=_b[suppins]
quietly regress ltotexp suppins phylim actlim totchr age female income if educyr==1
replace b0=_b[suppins] if educyr==1
quietly regress ltotexp suppins phylim actlim totchr age female income if educyr==2
replace b0=_b[suppins] if educyr==2
quietly regress ltotexp suppins phylim actlim totchr age female income if educyr==3
replace b0=_b[suppins] if educyr==3
quietly regress ltotexp suppins phylim actlim totchr age female income if educyr==4
replace b0=_b[suppins] if educyr==4
quietly regress ltotexp suppins phylim actlim totchr age female income if educyr==5
replace b0=_b[suppins] if educyr==5
quietly regress ltotexp suppins phylim actlim totchr age female income if educyr==6
replace b0=_b[suppins] if educyr==6
quietly regress ltotexp suppins phylim actlim totchr age female income if educyr==7
replace b0=_b[suppins] if educyr==7
quietly regress ltotexp suppins phylim actlim totchr age female income if educyr==8
replace b0=_b[suppins] if educyr==8
quietly regress ltotexp suppins phylim actlim totchr age female income if educyr==9
replace b0=_b[suppins] if educyr==9
quietly regress ltotexp suppins phylim actlim totchr age female income if educyr==10
replace b0=_b[suppins] if educyr==10
quietly regress ltotexp suppins phylim actlim totchr age female income if educyr==11
replace b0=_b[suppins] if educyr==11
quietly regress ltotexp suppins phylim actlim totchr age female income if educyr==12
replace b0=_b[suppins] if educyr==12
quietly regress ltotexp suppins phylim actlim totchr age female income if educyr==13
replace b0=_b[suppins] if educyr==13
quietly regress ltotexp suppins phylim actlim totchr age female income if educyr==14
replace b0=_b[suppins] if educyr==14
quietly regress ltotexp suppins phylim actlim totchr age female income if educyr==15
replace b0=_b[suppins] if educyr==15
quietly regress ltotexp suppins phylim actlim totchr age female income if educyr==16
replace b0=_b[suppins] if educyr==16
quietly regress ltotexp suppins phylim actlim totchr age female income if educyr==17
replace b0=_b[suppins] if educyr==17
这种写法太坑爹了。。。请教高手帮我改进下吧 万一我哪天遇上了分年度分行业做回归,并保存变量系数值,岂不是直接无语到家了。。。


雷达卡





京公网安备 11010802022788号







