我的代码如下,您试试:
- clear
- inp str4 industrycode industrysale
- 0101 138329
- 0101 24827
- 0102 24928
- 0102 132839
- 1610 267411
- 1610 124995
- 1610 354609
- 1610 5823
- 1621 5176
- 1621 105200
- 1621 144450
- 1621 30010
- 1621 211301
- 1711 87512
- 1711 115593
- 1711 13300
- 1711 68814
- 2911 346238
- 2911 103425
- 2911 272287
- 2911 160526
- end
- g ic1=substr(industrycode,1,2) //取出工业代码的前两位
- g ic2=substr(industrycode,-2,2) //取出工业代码的后两位
- destring ic1,gen(ic11)
- format ic11 %02.0f //保证第一位是0也能显现出来
- egen I=group(ic11) //这样就把前两位一样的行业归为一组
- egen i_sum=sum(industrysale),by(I) //把前两位相同代码的行业产值加总


雷达卡



京公网安备 11010802022788号







