Announcement

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

  • Underlying numbers for each percentile

    Dear Statalist,

    I need help with a Stata command that I can use to generate every 2nd percentile from the 5th to the 99th and be able to extract the underlying numbers of observations for each percentile that I have generated for a variable called wages.

    Best,

    Bridget
    Last edited by Bridget Kauma; 24 Aug 2022, 05:43.

  • #2
    maybe,
    Code:
    sysuse nlsw88, clear
    xtile pct = wage, nq(100)
    bysort pct: gen wanted = _N if inrange(pct,5,99) & mod(pct,2)

    Comment


    • #3
      In principle each percentile bin contains 1% of the data. If your data are sufficiently lumped that you won't get that result, then wanting so many different percentiles is intensely problematic.

      Comment


      • #4
        Øyvind Snilsberg Thank you so much it worked! Truly grateful
        .

        Comment

        Working...
        X