楼主: 修波
934 0

[数据管理求助] 分组求和结果不一致怎么解决? [推广有奖]

学科带头人

1%

还不是VIP/贵宾

-

威望
0
论坛币
47877 个
通用积分
60.4305
学术水平
8 点
热心指数
9 点
信用等级
6 点
经验
10565 点
帖子
546
精华
0
在线时间
2490 小时
注册时间
2013-11-12
最后登录
2024-4-30

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币
本人使用工业企业数据库就业数据进行分组求和,但是发现分组计算后,不同组的总就业量计算结果是不一致的。根据部分同学提出的采用doule命令,计算结果依旧不一致,请问这种情况应该如何,多谢指教。

  1. * Example generated by -dataex-. To install: ssc install dataex
  2. clear
  3. input byte sheng_id int(shi_id year) long(class_da class_xiao) double emp_xiao
  4. 1 101 1998 14 1413 1073
  5. 1 101 1998 14 1414 5920
  6. 1 101 1998 14 1415  702
  7. 1 101 1998 14 1419 1165
  8. 1 101 1998 14 1420 4290
  9. 1 101 1998 14 1431 1243
  10. end
复制代码



  1. [/font]
  2. [font=Tahoma]* Example generated by -dataex-. To install: ssc install dataex[/font]
  3. [font=Tahoma]clearuse "C:\Users\xiubo\Desktop\Nicola方法计算多样化和专业化指数\1998-2013年——大类小类二级——制造业面板数据.dta"[/font]
  4. [font=Tahoma]total  [/font]emp_xiao
  5. [font=Tahoma]**按照门类大类计算就业量[/font]
  6. [font=Tahoma][color=#df402a][i]sort   year sheng_id shi_id class_da by     year sheng_id shi_id class_da : gen count_da = _n  bysort year sheng_id shi_id class_da : egen double emp_da=sum(emp_xiao)sort   year sheng_id shi_id class_da class_xiao count_dareplace emp_da = emp_da[_n-1] if emp_da == .[/i][/color][/font]
  7. [font=Tahoma][color=#df402a][i]duplicates drop class_da emp_da , force    [/i][/color][/font]
  8. [i]total  [/i][i]emp_da[/i][font=Tahoma][color=#df402a][i]**按照地级市计算就业量sort    year sheng_id shi_id  by      year sheng_id shi_id  : gen count_city = _n  bysort  year sheng_id shi_id  : egen double emp_city=sum(emp_da)sort    year sheng_id shi_id class_da  count_cityreplace emp_city = emp_city[_n-1] if emp_city == .[/i][/color][/font]
  9. [font=Tahoma][color=#df402a][i]duplicates drop shi_id emp_city , force   [/i][/color][/font]
  10. [font=Tahoma][color=#df402a][i]total  [/i][/color][/font][i]emp_city[/i]
  11. [font=Tahoma]end[/font]
  12. [font=Tahoma]
复制代码




total  emp_xiao=1.09e+09;  total emp_da=1.05e+09;    total  emp_city=1.42e+10
二维码

扫码加我 拉你入群

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

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

关键词:工业企业数据库 企业数据库 从业人员 计算结果 就业数据

修波的万花筒
您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注jltj
拉您入交流群

京ICP备16021002-2号 京B2-20170662号 京公网安备 11010802022788号 论坛法律顾问:王进律师 知识产权保护声明   免责及隐私声明

GMT+8, 2024-5-1 16:21