全部版块 我的主页
论坛 计量经济学与统计论坛 五区 计量经济学与统计软件 Stata专版
4824 2
2010-09-30
想要把ROE这一连续变量转化为指示变量,其中0<roe<0.01的,定义新变量information=1,否则information=0,

采用的具体命令如下:

generate information=1 if  0<roe<0.01
replace information=0 if roe<0
replace information=1 if roe>0.01

然后出现的问题是:
采用count if  information==1
结果是 145
但是 count if  0<roe<0.01
结果是504

为什么会存在这么大的差异,按理说应该一样啊,能否有高手帮忙回答一下
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

全部回复
2010-9-30 20:52:01
我觉得怪怪的,您的具体指令中,
为什么generate information=1 if  0<roe<0.01
然后又replace information=1 if roe>0.01

建议使用
gen information=.
replace information=0 if roe<=0 | roe>=0.01
replace information=1 if 0<roe<0.01

或者使用【下式是创造0与1好用的指令】
gen information=(roe>0 & roe<0.01)
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2011-10-10 15:19:34
高手
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群