I want to take a difference between the 5th and 95th percentile of the variable.
-
Login or Register
- Log in with
help egen
. sysuse auto, clear (1978 automobile data) . egen p95 = pctile(mpg), p(95) by(foreign) . egen p5 = pctile(mpg), p(5) by(foreign) . gen p95Mp5 = p95 - p5 . tabdisp foreign, c(p95 p5 p95Mp5) ---------------------------------------------- Car | origin | p95 p5 p95Mp5 ----------+----------------------------------- Domestic | 29 14 15 Foreign | 35 17 18 ----------------------------------------------
Comment