全部版块 我的主页
论坛 计量经济学与统计论坛 五区 计量经济学与统计软件 Stata专版
1011 3
2014-01-29
QQ图片20140129110714.jpg
大于或等于B列且小于等于C列  则返回对应的A列的值到F列
这是一个类似等级税收的表  要从上往下搜索
如果找不到对应 就把F列置为12
关键是从上往下怎么循环
二维码

扫码加我 拉你入群

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

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

全部回复
2014-1-30 06:33:59
not sure which column you want to compare to columns B and C.  If the columns are named as A B C and E in stata, you can do, if compare by observation

gen long F=A*(E<=C & E>=B)+12*(!(E<=C & E>=B))

if you need to do loop, not sure how you want to output since each obs can have more than 1 output.
二维码

扫码加我 拉你入群

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

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

2014-2-2 10:22:47
jjjj6666 发表于 2014-1-30 06:33
not sure which column you want to compare to columns B and C.  If the columns are named as A B C and ...
using column E to compare with B and C. You're a nice guy.
二维码

扫码加我 拉你入群

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

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

2014-2-2 11:02:48
thanks, hope it works.  Happy new year!
二维码

扫码加我 拉你入群

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

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

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

说点什么

分享

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