Announcement

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

  • median value in STATA

    Dear Statalist,

    Is it possible to get MEDIAN value in STATA. For example I want to know Median weight or age of adults of my survey population. May I know how can I get it.

    Thank you !

  • #2
    Hello Rumana,

    You can use

    Code:
    sum age, d
    I hope this helps

    Comment


    • #3
      This command gives mean only.
      But I am looking for MEDIAN.

      Thank you

      Comment


      • #4
        It gives more than the mean. Make sure you add the detail:

        Code:
        sum age, detail
        The median is basically your 50% Percentile

        You can also use:

        Code:
         
         univar age
        Mdn is your Median

        If the univar code is not installed in your stata, you can simply copy this code and paste it in your command:

        Code:
         ssc install univar
        Good luck

        Comment


        • #5
          Try -tabstat-.

          Code:
          tabstat varlist, stats(n mean median min max)

          Comment


          • #6
            Thank you so much! These are very helpful!

            Comment


            • #7
              As Saad noted, summary x, d gives the mean as the 50th percentile. You can access it if you need it using r(p50). Egen will also calculate medians and will do it by subgroups so if you need a variable with the median, egen is easier.

              Comment


              • #8
                Phil intended to say

                median as the 50th percentile.

                Comment

                Working...
                X