Announcement

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

  • Aggregate a complete dataset from individual level to a macro dataset

    Hi there, apologies if this topic is already mentioned somewhere or "to simple"!

    I want to plot a specific graph and it is been recommended to me, that i create a country level macro dataset for this purpose. So i want to create a dataset where all individual level data is aggregated to the countrylevel. I am using repeated cross sectional data. In the end I want to have a dataset in which there is one row per country for each year. Do I need to build the mean over countries for each variable individually? Do I need to reshape my data? I am not really sure what the best or the right approach is.
    Thank you for your help!

    Sarah

  • #2
    Without seeing an example from your data set, it is impossible to give specific advice, particularly with regard to whether you will need to -reshape- your data. So please use the -dataex- command to do show example data. 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.

    That said, it is likely that the final step will use the -collapse- command. You might want to read -help collapse- now, as you might learn enough there to solve your problem without further assistance.

    When asking for help with code, always show example data. When showing example data, always use -dataex-.

    Comment

    Working...
    X