全部版块 我的主页
论坛 计量经济学与统计论坛 五区 计量经济学与统计软件 Stata专版
4278 4
2013-08-05
处理数据时,经常遇到按照行业进行回归的情况,但是从数据库下的数据都是二级分类或者以上。求助怎样把二级分类转换成一级分类?一种比较笨的方法是,以制造业为例:
generate industry1="A"
replace industry1="C" if Industry=="C01"|Industry=="C0101"|Industry=="C0111"|Industry=="C0120"|Industry=="C03"|Industry=="C05"|Industry=="C0501"|Industry=="C11"|Industry=="C1120"|Industry=="C13"|Industry=="C1304"|Industry=="C14"|Industry=="C21"|Industry=="C25"|Industry=="C31"|Industry=="C35"|Industry=="C41"|Industry=="C4115"|Industry=="C43"|Industry=="C47"|Industry=="C48"|Industry=="C4815"|Industry=="C49"|Industry=="C4915"|Industry=="C4935"|Industry=="C51"|Industry=="C55"|Industry=="C57"|Industry=="C61"|Industry=="C6101"|Industry=="C6105"|Industry=="C6199"|Industry=="C65"|Industry=="C6505"|Industry=="C6510"|Industry=="C67"|Industry=="C69"|Industry=="C6901"|Industry=="C6935"|Industry=="C71"|Industry=="C7105"|Industry=="C73"|Industry=="C7301"|Industry=="C7310"|Industry=="C7340"|Industry=="C7350"|Industry=="C75"|Industry=="C7505"|Industry=="C76"|Industry=="C7601"|Industry=="C7610"|Industry=="C78"|Industry=="C81"|Industry=="C8105"|Industry=="C8110"|Industry=="C85"|Industry=="C8501"|Industry=="C99"
但是这个很麻烦,stata里有没有专门的对变量观测值的通配符?

或者有其他更简单的转换方法,求各位网友指教。。。
二维码

扫码加我 拉你入群

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

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

全部回复
2013-8-5 10:27:30

用这个命令就行了!
gen industry1=substr(industry,1,1)
二维码

扫码加我 拉你入群

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

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

2013-8-5 11:08:49
bbs0805 发表于 2013-8-5 10:27
用这个命令就行了!
gen industry1=substr(industry,1,1)
太好了,感谢指教,感激不尽!!!
二维码

扫码加我 拉你入群

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

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

2020-11-10 16:46:14
东邪雨 发表于 2013-8-5 11:08
太好了,感谢指教,感激不尽!!!
楼主,请问制造业二级分类的数据哪里可以获取
二维码

扫码加我 拉你入群

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

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

2020-12-3 20:53:49
兰浩海 发表于 2020-11-10 16:46
楼主,请问制造业二级分类的数据哪里可以获取
请问层主找到答案了吗   可以分享下吗  谢谢啦
二维码

扫码加我 拉你入群

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

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

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

说点什么

分享

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