Announcement

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

  • Panel Totals by year

    I have a panel of countries with each country having several banks. Each Bank has reported total assets for 7 years (2010-2017). I need to compute the total assets reported by banks every year in each country. That is, for Algeria that has, say, 10 banks I compute a total asset variable for 2010 for the 10 banks and another for 2011, 2012...2017 and for all countries. The data is as in the MWE;
    ----------------------- copy starting from the next line -----------------------
    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input str12 country int(Bankid year) double Totalassets str73 BankName
    "Algeria" 1 2010  1607993.76882333 "Albaraka of Algeria-Banque Al Baraka d'Algerie"
    "Algeria" 1 2011  1748494.25294995 "Albaraka of Algeria-Banque Al Baraka d'Algerie"
    "Algeria" 1 2012  1930642.46302471 "Albaraka of Algeria-Banque Al Baraka d'Algerie"
    "Algeria" 1 2013  2009832.04016556 "Albaraka of Algeria-Banque Al Baraka d'Algerie"
    "Algeria" 1 2014  1851712.25728125 "Albaraka of Algeria-Banque Al Baraka d'Algerie"
    "Algeria" 1 2015  1806870.01214562 "Albaraka of Algeria-Banque Al Baraka d'Algerie"
    "Algeria" 1 2016  1903090.34572183 "Albaraka of Algeria-Banque Al Baraka d'Algerie"
    "Algeria" 1 2017  2163289.48241564 "Albaraka of Algeria-Banque Al Baraka d'Algerie"
    "Algeria" 2 2010 6738024.959631484 "Algerie Poste"                                
    "Algeria" 2 2011  6738228.28201709 "Algerie Poste"                                
    end
    ------------------ copy up to and including the previous line ------------------


  • #2
    Code:
    bys country year: egen wanted= total(Totalassets)

    Comment


    • #3
      Thanks Andrew. Asante!!!

      Comment

      Working...
      X