Dear Profs and colleagues,
I am going to do: For every county (string variable), take the average level of diversity (blau_indexethnic) within the region (7 regions), and then I subtract the county’s level of diversity from this region average.(I mean for a given county, I take the average level of diversity within the region, and then I subtract the county’s level of diversity from this region average, means subtracting that country's diversity from the region level diversity)
[code]
year:2010-2019
NPC_FIC:firm ID
I use this command but it is wrong, because country PT which has zero blau_indexethnic must have zero regio-average as well, but it does not.
Any ideas are appreciated.
Cheers,
Paris
I am going to do: For every county (string variable), take the average level of diversity (blau_indexethnic) within the region (7 regions), and then I subtract the county’s level of diversity from this region average.(I mean for a given county, I take the average level of diversity within the region, and then I subtract the county’s level of diversity from this region average, means subtracting that country's diversity from the region level diversity)
[code]
year:2010-2019
NPC_FIC:firm ID
Code:
* Example generated by -dataex-. For more info, type help dataex clear input double(NPC_FIC year) str6 country float(region blau_indexethnic) 501244941 2010 "AD" 1 0 501339663 2010 "AD" 1 0 501061164 2010 "AD" 2 0 501077744 2010 "AD" 2 .03 501101357 2010 "AD" 4 .07 501043859 2010 "AD" 5 .01 502231489 2010 "AN" 1 .75 501037669 2010 "AO" 1 0 503205787 2010 "AO" 2 0 501036723 2010 "AO" 2 .07 501347430 2010 "AO" 3 .04 501033739 2010 "AO" 3 .6 501075483 2010 "AO" 4 .08 501361748 2010 "AO" 5 .05 501237916 2010 "AO" 5 .012 501973936 2010 "AO" 1 .5 501227384 2010 "SP" 1 .34 502490973 2010 "SP" 4 .79 501344192 2010 "SP" 4 .3 501305448 2010 "SP" 5 .4 501829031 2010 "SP" 5 .16 501227275 2010 "BR" 6 .5 500226662 2010 "BR" 6 .7 501050721 2010 "BR" 7 .9 501822217 2010 "BR" 7 .6666666 500721928 2010 "PT" 1 0 501171904 2010 "PT" 1 0 501244634 2010 "PT" 1 0 501611851 2010 "PT" 1 0 502222461 2010 "PT" 1 0 end
Code:
bysort year region country: egen region_avg = mean(blau_indexethnic) gen region_avg_excl = ( region_avg- blau_indexethnic)
Cheers,
Paris
Comment