Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Add missing observations

    I have this loop

    Code:
    			gen percentile = .
    			foreach i in 10 20 30 40 50 60 70 80 90 {
    			egen p`i' = pctile(revenue), p(`i')
    			replace percentile = `i' if revenue == p`i'
    			}
    			keep if !mi(percentile)
    The problem is that if there are equal percentiles (for example if p10 = p20 = p30) then it would only retain p30 in the variable percentile. Is there anyway I could duplicate the observations, so that percentile contain p10 and p20 so that I can graph all percentiles vs their respective revenue values?
Working...
X