楼主: spy1889
7399 11

[其他] [求助] encode 出错 [推广有奖]

  • 5关注
  • 5粉丝

已卖:1份资源

教授

22%

还不是VIP/贵宾

-

威望
0
论坛币
1244 个
通用积分
45.7039
学术水平
41 点
热心指数
43 点
信用等级
23 点
经验
12251 点
帖子
292
精华
0
在线时间
1913 小时
注册时间
2005-5-6
最后登录
2025-12-19

楼主
spy1889 发表于 2010-1-30 20:04:35 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

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

经管之家联合CDA

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

感谢您参与论坛问题回答

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

+2 论坛币
有一个字符型变量,要把它变为数值型变量,样本容量有40万,提示如下错误:
[P]     error . . . . . . . . . . . . . . . . . . . . . . . .  Return code 134
        too many values;
        (1) You attempted to encode a string variable that takes on more
        than 65,536 unique values.  (2) You attempted to tabulate a variable
        or pair of variables that take on too many values.  If you
        specified two variables, try interchanging the two variables.
        (3) You issued a graph command using the by option.  The by-variable
        takes on too many different values to construct a readable chart.

应该是违背了第一条
请问这种情况该如何处理?
谢谢!
二维码

扫码加我 拉你入群

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

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

关键词:encode code NCO COD ODE specified command encode option values

沙发
sungmoo 发表于 2010-1-30 21:39:19
试试real()函数

藤椅
eblog 发表于 2010-1-30 23:36:31
不知道你的字符型变量的内容都是些什么?
如果是非数字0-9组成的字符型变量用encode转换是没什么意义的
如果是数字0-9组成的字符型变量可考虑用real()转换

板凳
spy1889 发表于 2010-1-31 00:07:32
谢谢!刚试了,real确实可以~~
不过我是想变成encode那样的1,1,2,2...
刚试了group,和encode一样的效果~~
egen new1=group( num)

报纸
arlionn 在职认证  发表于 2010-1-31 17:10:13
* 产生新的公司代码(由于公司数目太多,encode命令无法使用)
    preserve
      keep id
      duplicates drop id, force
      sort id
      gen code = _n
      sort id
      save id.dta, replace   
    restore
      sort id year
      merge id using id.dta
      drop _merge

地板
spy1889 发表于 2010-1-31 21:52:23
5# arlionn

试了,可以~谢谢连老师!!

7
williamchow 发表于 2010-4-24 21:27:09
谢谢了,有所帮助!结合egen和real用了,呵呵!

8
一个小孩子 发表于 2010-4-26 22:33:50
arlionn 发表于 2010-1-31 17:10
* 产生新的公司代码(由于公司数目太多,encode命令无法使用)
    preserve
      keep id
      duplicates drop id, force
      sort id
      gen code = _n
      sort id
      save id.dta, replace   
    restore
      sort id year
      merge id using id.dta
      drop _merge
请问老师,第二个sort id 是做什么用啊?

9
weikeshetao 发表于 2011-4-13 05:01:19
连老师太牛了啊    。 楼上的就是sort 下吧,否则不好运行,不知道对不对啊。

10
haddy1009 发表于 2011-10-31 16:29:35
请问,如果不是0-9之间的数,而是好几位的数值,该如何出来encode 命令提示的 too many values问题呢,试过把matsize 设成4000,不起作用。请教连老师及各位大侠!多谢!小女子急用,谢谢!

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

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