I have a panel dataset of firms. Using this dataset, I am trying to create a new variable containing average values of an existing variable for top 1% or 5% of firms within industry and year.
For example, in the attached dataset, I am trying create a variable containing the average value of tfp_re for the top 1% of firms by industry and year.
Since the xtile command does not allow using "by", I wonder if there is a short cut to my problem.
For example, in the attached dataset, I am trying create a variable containing the average value of tfp_re for the top 1% of firms by industry and year.
Since the xtile command does not allow using "by", I wonder if there is a short cut to my problem.
Comment