Announcement

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

  • Group wise maximum of column

    I have a dataset with multiple country, state, district and number of blocks(float). I want to take the maximum value of the number of blocks with in a district and state and country. The max() function is returning the same number as number of blocks. Please suggest the how to do it? Thanks!

  • #2
    As you show no example data, and no code, it is anybody's guess what data you have, and what you did with it. Showing your code is especially important here since Stata has two different max() functions, which do different things and apply to different data layouts. So any attempt to answer your question would be speculative. Please post back with an example of your data set (using the -dataex- command to do so) and the exact command(s) you ran to attempt to solve your problem. I think you will be able to get a helpful reply if you do that.

    If you are running version 17, 16 or a fully updated version 15.1 or 14.2, -dataex- is already part of your official Stata installation. If not, run -ssc install dataex- to get it. Either way, run -help dataex- to read the simple instructions for using it. -dataex- will save you time; it is easier and quicker than typing out tables. It includes complete information about aspects of the data that are often critical to answering your question but cannot be seen from tabular displays or screenshots. It also makes it possible for those who want to help you to create a faithful representation of your example to try out their code, which in turn makes it more likely that their answer will actually work in your data.

    Comment

    Working...
    X