嗨,我正试着制作一个有很多片的饼图。由于某些原因,运行此代码时会出现错误。我的代码
graph pie ccounter if year==1900 & ccounter>100 & labforce==2, over(occ1950)
我得到了这个错误
(note: areastyle p193pie not found in scheme, default attributes used)
(note: areastyle p194pie not found in scheme, default attributes used)
(note: areastyle p195pie not found in scheme, default attributes used)
(note: areastyle p196pie not found in scheme, default attributes used)
option min() incorrectly specified
注意,变量occ1950有超过100个值。我不知道这是不是造成问题的原因。
额外信息
我使用这段代码创建变量c计数器。
bys mcdstr year occ: gen counter=_n
bys mcdstr year occ: egen ccounter=max(counter)
我用它来计算按年和地点在每个行业工作的人数。
发布于 2017-06-10 17:57:00
问题在于变量occ1950
有太多的唯一值。让我们使用仅40个国家的CSV数据来研究这一问题。
country,fdi
Afghanistan,141.391
Algeria,541.478
Angola,238.637
Antigua and Barbuda,1.653
Argentina,205.691
Bahamas,21.927
Bahrain,1.317
Bangladesh,50.298
Barbados,2.816
"Bolivia, Plurinational State of",41.572
Botswana,87.649
Brazil,455.5649999999999
British Virgin Islands,12387.568
Brunei Darussalam,21.02
Cambodia,672.6800000000001
Cameroon,30.159
Cape Verde,3.783
Cayman Islands,15323.116
Chile,53.149
Colombia,49.047
Congo,112.104
"Congo, Democratic Rep. of",302.505
Costa Rica,.826
Côte d' Ivoire,27.099
Dominican Republic,.112
Ecuador,93.673
Egypt,191.59
Equatorial Guinea,80.21700000000001
Eritrea,16.269
Ethiopia,205.824
Fiji,38.742
Gabon,76.66500000000001
Ghana,129.068
Guinea,97.413
Guyana,79.899
Honduras,2.6
"Hong Kong, China",124987.422
India,291.567
Indonesia,850.0709999999999
"Iran, Islamic Republic of",480.71
在将它加载到Stata 14中之后,我们可以观察到
graph pie fdi, over(country)
生成错误:option min() incorrectly specified
。
如果我们现在通过:drop _n > 30
将数据集简化为30个国家。我们就能拿到派图了。
这意味着您应该折叠您的数据,使用最大的ccounter
的n个类别,然后将其他类分类为" other“。
幻数是36。因此,你最多可以有36个独特的类别在你的饼图。
https://stackoverflow.com/questions/26804293
复制相似问题