Dear Profs and colleagues,
I am going to generate HHI, Shannon, etc by using entropyetc, however, it says nothing to do.
So I explain what I seek, perhaps I am wrong in what I am doing.
I would like to generate diversity indices for a categorical variable Edugroup for only foreigners, data has local and foreigners. When foreign==1 is foreigners. (I don't wanna use keep if foreign==1)
NPC_FIC is firm ID. year 2010-2019.
If does not work with hhi.
Any ideas appreciated.
Cheers,
Paris
I am going to generate HHI, Shannon, etc by using entropyetc, however, it says nothing to do.
So I explain what I seek, perhaps I am wrong in what I am doing.
I would like to generate diversity indices for a categorical variable Edugroup for only foreigners, data has local and foreigners. When foreign==1 is foreigners. (I don't wanna use keep if foreign==1)
NPC_FIC is firm ID. year 2010-2019.
Code:
* Example generated by -dataex-. For more info, type help dataex
clear
input double(year NPC_FIC) float(foreign Edugroup)
2010 500000001 1 2
2010 500000001 0 2
2010 500000001 1 2
2010 500000002 0 2
2010 500000002 12
2010 500000002 0 2
2010 500000002 0 2
2011 500000002 0 2
2011 500000002 1 4
2011 500000002 0 2
2011 500000002 0 2
2012 500000002 0 2
2012 500000002 0 2
2012 500000002 1 4
2012 500000002 0 2
2012 500000002 1 2
2013 500000002 0 2
2013 500000002 1 2
2013 500000002 0 2
2013 500000002 0 2
2014 500000002 0 2
2015 500000002 0 2
2015 500000002 0 2
2016 500000002 0 2
2016 500000002 0 2
2017 500000002 0 2
2017 500000002 0 2
2010 500000033 0 2
2010 500000033 1 2
2011 500000033 0 2
2011 500000033 0 2
2012 500000033 1 2
2012 500000033 0 2
2013 500000033 0 2
2014 500000033 0 2
2015 500000033 0 2
2015 500000033 0 4
2016 500000033 0 2
2017 500000033 0 2
2018 500000033 0 2
2019 500000033 0 2
2010 500000050 0 1
2010 500000050 1 2
2011 500000050 0 2
2012 500000050 1 2
2013 500000050 1 2
2014 500000050 0 2
2014 500000050 0 2
2015 500000050 0 2
2015 500000050 0 2
2019 500000073 0 2
2010 500000083 0 3
2011 500000083 0 3
2012 500000083 0 3
2013 500000083 0 3
2014 500000083 0 3
2015 500000083 0 3
2016 500000083 0 3
2017 500000083 0 3
2018 500000083 0 3
2018 500000083 0 3
2019 500000083 0 3
2019 500000083 0 3
2015 500000101 0 2
2016 500000101 0 2
2017 500000101 0 2
2018 500000101 0 2
2019 500000101 0 2
2010 500000104 1 2
2011 500000106 0 2
2011 500000113 0 3
2012 500000113 0 2
2013 500000113 0 2
2014 500000113 0 2
2010 500000119 0 2
2010 500000119 1 1
2010 500000119 1 2
2010 500000119 1 2
2010 500000119 0 2
2010 500000119 0 2
2010 500000119 0 2
2010 500000119 0 2
2011 500000119 0 2
2011 500000119 0 2
2011 500000119 0 2
2011 500000119 0 2
2011 500000119 0 1
2011 500000119 0 2
2011 500000119 0 2
2011 500000119 0 2
2011 500000119 0 2
2013 500000119 0 1
2013 500000119 0 2
2012 500000119 0 3
2012 500000119 0 2
2013 500000119 0 2
2012 500000119 0 2
2012 500000119 1 2
2012 500000119 0 2
2015 500000121 0 4
end
. tab Edugroup
Edugroup | Freq. Percent Cum.
------------+-----------------------------------
1 | 2,906,475 10.91 10.91
2 | 11,098,633 41.66 52.57
3 | 7,393,341 27.75 80.32
4 | 5,243,652 19.68 100.00
------------+-----------------------------------
Total | 26,642,101 100.00
. tab foreign
foreign | Freq. Percent Cum.
------------+-----------------------------------
0 | 25,295,665 94.95 94.95
1 | 1,346,436 5.05 100.00
------------+-----------------------------------
Total | 26,642,101 100.00
Code:
g id= group(NPC_FIC) . hhi Edugroup, by(year id) if foreign==1 option if not allowed r(198); . entropyetc Edugroup, by(id year foreign) nothing to do
Cheers,
Paris

Comment