Announcement

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

  • Dropping lowest/highest percentiles?

    hi again,

    I am trying to drop lowest and highest percentiles in my data. I am using the following commands. I am wondering whether there is a more elegant way (without writing the numbers, 98&8977747) to do this? Becasue everytime ı run teh program I have to go back to data and check it whether these numbers match with the original statistics?


    centile rtasset, centile( 0.05 25 50 75 99.5)
    replace rtasset=. if rtasset<=98
    replace rtasset=. if rtasset> 8977747


  • #2
    Your code doesn't drop anything, but it changes the data to missing under stated conditions.

    I'd strongly advise against ever doing that on statistical and data management grounds.

    At most, create an indicator variable for what you are including or excluding for certain purposes.

    You can use the saved results of centile for that purpose.

    My personal bias against analysing data in this way stops me telling you more.


    Comment


    • #3
      Thank you, Nick. I appreciate your comment... Let's say that I want to create a dummy for each category. Is this the way to do it? Or is there a built-in command that automatically creates the categories?

      centile x, centile( 0.5 25 50 75 99.5)
      gen d_e=1 if x>0.39
      replace d_e=2 if x<=0.12
      replace d_e=3 if x<=0.02
      replace d_e=. if x==.

      Comment


      • #4
        Check out -xtile-. It won't do dummies, but it will do a categorical variable that will do pretty much what you want, and you can use it as an indicator variable in regressions without even transforming it.

        Comment


        • #5
          I'll tell you more: see http://www.statalist.org/forums/forum/general-stata-discussion/general/603013-winsorized-the-variables-at-leve-1-and-99
          Steve Samuels
          Statistical Consulting
          [email protected]

          Stata 14.2

          Comment


          • #6
            I'll tell you more: see http://www.statalist.org/forums/forum/general-stata-discussion/general/603013-winsorized-the-variables-at-leve-1-and-99
            Steve Samuels
            Statistical Consulting
            [email protected]

            Stata 14.2

            Comment

            Working...
            X