Announcement

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

  • How do I find the summary statistics of top 50 richest countries in a 100 country dataset

    I want to determine the mean, standard deviation etc. for the top 50 countries by GDP in a 100 country dataset. I have sorted in descending order using gsort command but unable to figure how to find mean for the top 50.
    I can always use the crude way of visually looking at the 51st country and then using the "if {var} > {value} but I am sure there must something more elegant in STATA

  • #2
    Look up egen's "rank" function. Note that if you have panel data, countries may not have the same rank year by year

    Comment


    • #3
      Assuming that you are not dealing with panel data:
      Code:
      sysuse auto, clear
      
      gsort -price
      // DESCRIPTIVE STATISTICS FOR 50 MOST EXPENSIVE CARS
      summ price mpg headroom in 1/50
      illustrates the approach.

      Comment

      Working...
      X