初学stata的傻姑娘一个,想知道双重循环怎么做,数据如下。 gen IPD1 = 0

论坛 期权论坛 期权     
哈哈呢   2019-2-9 16:33   6091   1
初学stata的傻姑娘一个,想知道双重循环怎么做,数据如下。
gen IPD1 = 0                                          //设置虚拟变量
forvalues i=2011/2015{
replace IPD1 = 1 if Indcd =="A01" & year==`i'
}
forvalues i=2011/2015{
replace IPD1 = 1 if Indcd =="C36" & year==`i'
}
forvalues i=2011/2015{
replace IPD1 = 1 if Indcd =="C32" & year==`i'
}
forvalues i=2011/2015{
replace IPD1 = 1 if Indcd =="C17" & year==`i'
}
forvalues i=2011/2015{
replace IPD1 = 1 if Indcd =="C26" & year==`i'
}
forvalues i=2011/2015{
replace IPD1 = 1 if Indcd =="C27" & year==`i'
}
forvalues i=2011/2015{
replace IPD1 = 1 if Indcd =="C25" & year==`i'
}
forvalues i=2011/2015{
replace IPD1 = 1 if Indcd =="C37" & year==`i'
}
  forvalues i=2011/2015{

自从学了stata,真切感受到了智商是个好东西,只可惜自己没有...
分享到 :
0 人收藏

1 个回复

倒序浏览
2#
知心de姐姐  8级牛人 | 2019-2-9 16:34:19
local mm " y1 y2 y3...yn"聽 聽
local nn "x1 x2 x3.."
foreach w of varlist `nn' {聽聽
foreach v of varlist `mm' {
xi: probit `v'聽聽`w', robust
est store `v'_`w'
}
}试试看
               
                                    
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

积分:0
帖子:1366
精华:0
期权论坛 期权论坛
发布
内容

下载期权论坛手机APP