Hi all,

I want to truncate (not winsorize) the most extreme 1 percent of earnings. However, I do not know how to do this. My dataset looks like this (simplified):
Note: earnings is already scaled by average total assets. Therefore, the values are low.

Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input str6 gvkey double fyear float Earn
"001004" 2002  .069433704
"001004" 2003   .09366571
"001004" 2004   .06395068
"001004" 2005   .00225294
"001004" 2006  -.04376862
"001004" 2007   .05516222
"001004" 2008  .014650915
"001004" 2009   .07596077
"001004" 2010   .04182295
"001004" 2011   .10636716
"001004" 2012  .028460857
"001004" 2013   .07873188
"001004" 2014  -.09327173
"001004" 2015   .01596238
"001004" 2016    .0748177
"001004" 2017   .06239358
"001004" 2018   .01184788
"001013" 2003   .11190998
"001013" 2004   .18013138
"001013" 2005   .04881214
"001013" 2006 -.008894078
"001013" 2007   .10534018
"001013" 2008   .09784136
"001013" 2009 -.007185459
"001013" 2010   .16246234
"001034" 2003   .06254857
"001034" 2004   .04231646
"001034" 2005  .033480093
"001034" 2006     .205559
"001034" 2007   .03662908
"001038" 2002   .10530272
"001038" 2003   .12154207
"001045" 2003   .07058154
"001045" 2004  .017279265
"001045" 2005   .04276995
"001045" 2006   .05527683
"001045" 2007   .08618657
"001045" 2008  -.05465978
"001045" 2009 -.003224015
"001045" 2010     .077378
"001045" 2011   .03835765
"001045" 2012    .0459423
"001045" 2013   .06547737
"001045" 2014   .02320717
"001045" 2015    .1101205
"001045" 2016    .1618523
"001045" 2017   .09375992
"001045" 2018   .05428436
"001050" 2003   .10410062
"001050" 2004   .14352474
"001050" 2005   .03800196
"001050" 2006    .2147853
"001050" 2007  -.14851879
"001050" 2008  -.01105276
"001050" 2009  -.00946848
"001050" 2010   .12418208
"001050" 2011   .14547464
"001050" 2012   .14874977
"001050" 2013    .3618757
"001050" 2014  -.13913119
"001050" 2015   .05535443
"001050" 2016   .02353288
"001050" 2017  .035376854
"001050" 2018 -.017243665
"001056" 2003  -.04523037
"001056" 2004    .1733007
"001056" 2005  -.06380673
"001056" 2006   .09907055
"001072" 2002   .17861393
"001072" 2003  .015089057
"001072" 2004   .09200164
"001072" 2005   .03811658
"001072" 2006   .17410243
"001072" 2007   .13513482
"001072" 2008  -.04685184
"001072" 2009   .12183116
"001072" 2010   .14520466
"001072" 2011  .033670727
"001072" 2012  .026322335
"001072" 2013  -.03926912
"001072" 2014    .1094193
"001072" 2015 -.005357519
"001072" 2016   .14301506
"001072" 2017   .12882896
"001072" 2018   .06967193
"001075" 2005   .17439023
"001075" 2006  -.07582778
"001075" 2007   .04151408
"001075" 2008   .12286757
"001075" 2009   .08130658
"001075" 2010  .062811024
"001075" 2011    .0845019
"001075" 2012   .10071879
"001075" 2013  .072788104
"001075" 2014  .073774114
"001075" 2015   .07311531
"001075" 2016    .0734632
"001075" 2017    .0793887
"001075" 2018   .05596517
"001076" 2012  .032616034
end
I hope there is a simple way/code to solve this problem.
Thank you in advance.

Roy