Dear Profs and Colleagues,
I am going to determine "the number of observations associated with firms that have both native and non-native workforces". There are several variables: firm ID:NPC_FIC, year, 2010-2019. if national=0 is non-native , if national=1 is native. I need to know among 441,475 firms, how many have both native and non-native workers. Surely would be few firms. What would be the command? Any ideas are appreciated.
Cheers,
Paris
I am going to determine "the number of observations associated with firms that have both native and non-native workforces". There are several variables: firm ID:NPC_FIC, year, 2010-2019. if national=0 is non-native , if national=1 is native. I need to know among 441,475 firms, how many have both native and non-native workers. Surely would be few firms. What would be the command? Any ideas are appreciated.
Code:
* Example generated by -dataex-. For more info, type help dataex
clear
input double(year NPC_FIC) float national
2015 500003242 1
2016 500003242 1
2017 500003242 .
2018 500003242 .
2019 500003242 .
2010 500003770 1
2011 500003770 1
2012 500003770 1
2013 500003770 1
2014 500003770 1
2015 500003770 1
2016 500003770 1
2017 500003770 1
2018 500003770 .
2010 500004847 .
2010 500008310 1
2011 500008310 1
2013 500008310 1
2014 500008310 1
2015 500008310 1
2016 500008310 .
2017 500008310 .
2018 500008310 .
2019 500008310 .
2010 500009155 1
2011 500009155 1
2012 500009155 1
2013 500009155 1
2014 500009155 1
2015 500009155 1
2016 500009155 1
2017 500009155 1
2018 500009155 1
2019 500009155 1
2010 500013486 1
2011 500013486 1
2012 500013486 1
2013 500013486 .
2014 500013486 .
2015 500013486 .
2016 500013486 .
2017 500013486 .
2018 500013486 .
2019 500013486 1
2010 500017393 .
2011 500017393 .
2014 500017854 .
2015 500017854 .
2010 500019512 1
2011 500019512 1
2012 500019512 1
2013 500019512 1
2014 500019512 1
2015 500019512 .
2016 500019512 .
2017 500019512 .
2018 500019512 .
2019 500019512 .
2010 500020809 1
2011 500020809 1
2012 500020809 1
2013 500020809 1
2014 500020809 1
2015 500020809 1
2016 500020809 1
2017 500020809 .
2018 500020809 .
2019 500020809 .
2016 500023255 .
2010 500026382 .
2011 500026382 .
2012 500026382 .
2010 500027353 1
2011 500027353 1
2012 500027353 1
2013 500027353 1
2014 500027353 1
2015 500027353 1
2016 500027353 1
2017 500027353 1
2018 500027353 1
2019 500027353 .
2010 500031300 .
2011 500031300 .
2012 500031300 .
2013 500031300 .
2014 500031300 .
2015 500031300 .
2016 500031300 .
2017 500031300 .
2018 500031300 .
2019 500031300 .
2010 500049799 0
2011 500049799 0
2012 500049799 0
2013 500049799 1
2014 500049799 1
2015 500049799 1
2016 500049799 1
2017 500049799 0
end
. tab national
national | Freq. Percent Cum.
------------+-----------------------------------
0 | 70,372 4.52 4.52
1 | 1,487,765 95.48 100.00
------------+-----------------------------------
Total | 1,558,137 100.00
. egen firm_count = tag(NPC_FIC)
. tab firm_count, gen(num_firms)
tag(NPC_FIC |
) | Freq. Percent Cum.
------------+-----------------------------------
0 | 1,867,665 80.88 80.88
1 | 441,475 19.12 100.00
------------+-----------------------------------
Total | 2,309,140 100.00
Paris

Comment