楼主: beanbean1030
2777 4

[其他] 20万个类别,每个类别加一个序号,变成面板? [推广有奖]

  • 0关注
  • 1粉丝

硕士生

62%

还不是VIP/贵宾

-

威望
0
论坛币
2442 个
通用积分
0
学术水平
0 点
热心指数
1 点
信用等级
0 点
经验
2114 点
帖子
133
精华
0
在线时间
110 小时
注册时间
2011-2-24
最后登录
2019-6-2

楼主
beanbean1030 发表于 2012-4-24 18:14:34 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

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

经管之家联合CDA

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

感谢您参与论坛问题回答

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

+2 论坛币
有这样一个变量(字符型)
0008
0008
A111
A111
0222
0222
B77777
B77777
...
如何把这个变量变成面板的idcode呀?
即变成下面这个形式
1
1
2
2
3
3
4
4
谢谢好心人!随手写个命令告诉一下吧!谢谢啦谢谢!

...
二维码

扫码加我 拉你入群

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

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

关键词:idcode code 好心人 字符型 ODE 好心人 如何

沙发
beanbean1030 发表于 2012-4-24 18:15:41
顶起来!

藤椅
蓝色 发表于 2012-4-24 18:52:52
egen idcode=group( 变量)



       group(varlist) [, missing label lname(name) truncate(num)]
            may not be combined with by.  It creates one variable taking on values 1, 2, ...
            for the groups formed by varlist.  varlist may contain numeric variables, string
            variables, or a combination of the two.  The order of the groups is that of the
            sort order of varlist.  missing indicates that missing values in varlist
            (either . or "") are to be treated like any other value when assigning groups,
            instead of as missing values being assigned to the group missing.  The label
            option returns integers from 1 up according to the distinct groups of varlist in
            sorted order.  The integers are labeled with the values of varlist or the value
            labels, if they exist.  lname() specifies the name to be given to the value label
            created to hold the labels; lname() implies label.  The truncate() option
            truncates the values contributed to the label from each variable in varlist to
            the length specified by the integer argument num.  The truncate option cannot be
            used without specifying the label option.  The truncate option does not change
            the groups that are formed; it changes only their labels.

板凳
sungmoo 发表于 2012-4-24 18:59:01
egen idcode=group(x)

报纸
beanbean1030 发表于 2012-4-24 22:03:14
谢谢楼上两位啦!原来是版主!失敬失敬!

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

本版微信群
加好友,备注jltj
拉您入交流群
GMT+8, 2026-1-2 06:16