Announcement

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

  • How to add up variables in Stata by totaling up values

    Hi there, I am trying to add values of my demand variable together but struggling to do so. Attached is a file with what my data looks like. I would like to total out the total demand by year globally, versus separated by country/region. Please let me know how and if this is possible. Lastly, I would also like to convert this annual data into monthly data, please let me know how to do so. Would appreciate any assistance!
    Attached Files

  • #2
    Please, do read the FAQ to learn how to ask a question. You need to provide an example of your real data with dataex.

    Comment


    • #3
      #2 plus see

      Code:
      help egen
      for its total() function and use e.g. double type as in some variation on

      Code:
      egen double wanted = total(whatever), by(year)
      to hold totals precisely.

      Comment

      Working...
      X