I want to trim my data in Stata by dropping the top/bottom 1% of Prices. I know how to do this in general using the -summarize- command. However, I would like to do this by groups. I have several industries, I want to do the trimming within each industry. In the end I would like to have one dummy variable (to_use) equal to one if observation is not within the indicated price outliers in any industry.
An example of my data:
----------------------------------
Industry | Product | Price |
----------------------------------
Food | Apples | $ 10 |
Food | Fish | $ 20 |
Food | Bread | $ 5 |
Cars | Car A | $ 100 |
Cars | Car B | $ 200 |
An example of my data:
----------------------------------
Industry | Product | Price |
----------------------------------
Food | Apples | $ 10 |
Food | Fish | $ 20 |
Food | Bread | $ 5 |
Cars | Car A | $ 100 |
Cars | Car B | $ 200 |
Comment