Announcement

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

  • Sorting the results of a two-way table

    Hello,

    I am using the newest version of Stata (14.1), and I need help with getting a sorted two-way table. In order to get the table I wanted for my data set, I used the following code: "svy: tab county smoker2, row". This gave me the proportion of current smokers in each county in Missouri. However, the results are not in order and there are a lot of counties in Missouri. For my assignment, I need the 5 counties with the lowest and highest smoking prevalence. Is there any way to both get the total proportion of smokers in each county (I used the option "row" for this) and have a sorted table in the results? I can't find the answer to this anywhere online. Thank you very much for your help.

    Kelsey

  • #2
    Not sure if the table command accepts weights, but I would use that to create a dataset containing the summary statistics and then you can filter the records from there.

    Comment


    • #3
      Yes, table accepts weights, and specifically relevant here, it accepts pweights. For that matter, table is a wrapper for -collapse-, which also accepts all kinds of weights, and that is really the part that is relevant here.

      Comment

      Working...
      X