Then you are counting firms in a category in at least one sample year. Here is an example with some observation counts modified (highlighted):
Res.:
Code:
* Example generated by -dataex-. For more info, type help dataex clear input double(year NPC_FIC pempl) 2010 500000001 3 2010 500000002 5 2011 500000002 4 2012 500000002 5 2013 500000002 4 2014 500000002 1 2015 500000002 2 2016 500000002 2 2017 500000002 2 2018 500000002 1 2010 500000033 2 2011 500000033 2 2012 500000033 2 2013 500000033 1 2014 500000033 1 2015 500000033 2 2016 500000033 1 2017 500000033 1 2018 500000033 1 2019 500000033 1 2010 500000050 2 2011 500000050 1 2012 500000050 1 2013 500000050 1 2014 500000050 2 2015 500000050 2 2016 500000069 1 2017 500000069 1 2019 500000073 2 2010 500000083 1 2011 500000083 1 2012 500000083 1 2013 500000083 1 2014 500000083 1 2015 500000083 1 2016 500000083 1 2017 500000083 1 2018 500000083 2 2019 500000083 2 2015 500000101 1 2016 500000101 1 2017 500000101 1 2018 500000101 1 2019 500000101 1 2010 500000104 2 2011 500000106 1 2011 500000113 1 2012 500000113 1 2013 500000113 1 2014 500000113 1 2010 500000119 8 2011 500000119 9 2012 500000119 8 2010 500000121 2 2011 500000150 1 2012 500000150 1 2013 500000150 1 2014 500000150 1 2010 500000156 2 2016 500000156 1 2017 500000156 1 2018 500000156 1 2019 500000156 1 2010 500000157 4 2011 500000157 3 2012 500000157 2 2010 500000165 4 2011 500000165 4 2012 500000165 3 2013 500000165 3 2014 500000165 3 2015 500000165 3 2016 500000165 3 2017 500000165 3 2010 500000180 1 2010 500000198 3 2011 500000198 3 2012 500000198 2 2013 500000198 2 2014 500000198 2 2015 500000198 2 2016 500000198 2 2017 500000198 20 2010 500000201 1 2011 500000201 1 2012 500000201 1 2013 500000201 1 2010 500000204 2 2011 500000204 2 2012 500000204 2 2013 500000204 3 2014 500000204 3 2015 500000204 3 2016 500000204 23 2017 500000204 3 2018 500000204 1 2019 500000204 2 2010 500000212 1 2011 500000212 1 2012 500000212 299 end bys NPC_FIC: egen tag1 = max(pempl<=10) lab var tag1 "1 to 10 employees" bys NPC_FIC: egen tag2 = max(inrange(pempl, 11, 250)) lab var tag2 "11 to 250 employees" bys NPC_FIC: egen tag3 = max(pempl>250) lab var tag3 "more than 250 employees" egen tag= tag(NPC_FIC) *TOTAL NUMBER OF FIRMS table tag if tag, nototal *FIRMS WITH LESS THAN 10 EMPLOYEES IN AT LEAST ONE SAMPLE YEAR table tag1 if tag1 & tag, nototal *FIRMS WITH 11-250 EMPLOYEES IN AT LEAST ONE SAMPLE YEAR table tag2 if tag2 & tag, nototal *FIRMS WITH MORE THAN 250 EMPLOYEES IN AT LEAST ONE SAMPLE YEAR table tag3 if tag3 & tag, nototal
Code:
. *TOTAL NUMBER OF FIRMS
.
. table tag if tag, nototal
-------------------------
| Frequency
-------------+-----------
tag(NPC_FIC) |
1 | 22
-------------------------
.
.
.
. *FIRMS WITH LESS THAN 10 EMPLOYEES IN AT LEAST ONE SAMPLE YEAR
.
. table tag1 if tag1 & tag, nototal
------------------------------
| Frequency
------------------+-----------
1 to 10 employees |
1 | 22
------------------------------
.
.
.
. *FIRMS WITH 11-250 EMPLOYEES IN AT LEAST ONE SAMPLE YEAR
.
. table tag2 if tag2 & tag, nototal
--------------------------------
| Frequency
--------------------+-----------
11 to 250 employees |
1 | 2
--------------------------------
.
.
.
. *FIRMS WITH MORE THAN 250 EMPLOYEES IN AT LEAST ONE SAMPLE YEAR
.
. table tag3 if tag3 & tag, nototal
------------------------------------
| Frequency
------------------------+-----------
more than 250 employees |
1 | 1
------------------------------------


Comment