- * Example generated by -dataex-. To install: ssc install dataex
- clear
- input byte sheng_id int(shi_id year) long(class_da class_xiao) double emp_xiao
- 1 101 1998 14 1413 1073
- 1 101 1998 14 1414 5920
- 1 101 1998 14 1415 702
- 1 101 1998 14 1419 1165
- 1 101 1998 14 1420 4290
- 1 101 1998 14 1431 1243
- end
- [/font]
- [font=Tahoma]* Example generated by -dataex-. To install: ssc install dataex[/font]
- [font=Tahoma]clearuse "C:\Users\xiubo\Desktop\Nicola方法计算多样化和专业化指数\1998-2013年——大类小类二级——制造业面板数据.dta"[/font]
- [font=Tahoma]total [/font]emp_xiao
- [font=Tahoma]**按照门类大类计算就业量[/font]
- [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]
- [font=Tahoma][color=#df402a][i]duplicates drop class_da emp_da , force [/i][/color][/font]
- [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]
- [font=Tahoma][color=#df402a][i]duplicates drop shi_id emp_city , force [/i][/color][/font]
- [font=Tahoma][color=#df402a][i]total [/i][/color][/font][i]emp_city[/i]
- [font=Tahoma]end[/font]
- [font=Tahoma]
total emp_xiao=1.09e+09; total emp_da=1.05e+09; total emp_city=1.42e+10