Hi there,

I am trying to remove 2-digit sic codes for which my dataset has less than 10 companies.
I have made a numerical variable of the first two digits of the sic code:
gen sic2 = substr(sic,1,2)
destring sic2, gen(sicnum2)

Does someone know what type of command I should put based on number of companies conditional? Note that I have data for various years per company.

Hope someone can help out.

Kind regards,
Sarah