楼主: 晓风月
10583 14

[数据管理求助] 如何用stata把相同编码的value值进行加总 [推广有奖]

11
晓风月 发表于 2016-10-28 22:02:20
anthonyp2016 发表于 2016-10-28 21:36
先用encode将五类产品生成一个新变量var1,再bys country var1: egen new_var = sum(value).
就是用您刚才说的那个encode的吗?可是在stata中运行,提示1 invalid name。这是为何?
encode  code (1 11 22 25 34 36 41 42 43 44 45 54 57 71 72 74 75 81 91 121 211 212 222 223 232 244 245 246 261 263 268 271 273 274 277 278 291 292 322 333 341 681 682 683 684 685 686 687 =1) (12 14 23 24 35 =2) (281 282 286 287 288 =3) (611 612 613 651 652 =4) (642 665 666 673 674 675 =5) (781 782 783 784 785 =6) (266 267 512 513 533 553 554 =7) (711 713 714 721 722 723 724 =8) (716 718 751 752 759 761 764 771 774 776 778 =9) (524 541 712 792 871 874 881 =10) , gen(group)

12
anthonyp2016 发表于 2016-10-28 22:23:39
encode  comcode?

13
晓风月 发表于 2016-10-28 22:26:52
anthonyp2016 发表于 2016-10-28 22:23
encode  comcode?
我的编码名称是comcode,这个改过来了,还是存在那个invalid name的问题

14
anthonyp2016 发表于 2016-10-28 22:38:55
不好意思 recode……

15
晓风月 发表于 2016-10-28 23:03:54
anthonyp2016 发表于 2016-10-28 22:38
不好意思 recode……
多谢多谢,试了下。recode可行。辛苦啦

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注jltj
拉您入交流群
GMT+8, 2025-12-29 03:19