Announcement

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

  • coverage market cap per country; total market cap country/total market cap europe

    Hi everyone,

    I have a panel data set containing stocks. I have a variable mofd that goes from 2013m1 till 2022m5. I have a variable Code containing the specific company Code. I also have the variabel Country containing the country code for each stock, f.e. GB = UK(great Britain). I also have a variabel MV containing the market value of a company in a certain month.

    I want to calculate for a random month (preferably a month with almost every observation (537.501) the market cap percentage for a country. I want the market cap percentage for all country's, which would sum up to 100%.
    So the steps in my head would be:
    1. Sum all MV values in month x for country x
    2. sum all MV values in month x for every country (total)
    3. divide sum MV values for country x by sum of all MV values

    I hope to get a list with a market cap percentage of the total for every company.
    Again the month doesn't matter, but it would be best if I would take the month with the most observations.
    I hope you can help me. Here is an example of my data.

    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input str6 Code float mofd str2 Country double MV
    "265429" 637 "AT"      .12
    "255055" 637 "AT"  5118.88
    "50867Q" 637 "AT"     8.52
    "307059" 637 "AT"  1418.64
    "35744M" 637 "AT"   147.46
    "505096" 637 "AT"  2138.75
    "143539" 637 "AT"      119
    "866289" 637 "AT"  3680.38
    "540181" 637 "AT"   976.96
    "307332" 637 "AT"   320.23
    "276484" 637 "AT"  2280.49
    "779332" 637 "AT"  2688.84
    "41672K" 637 "AT"    76.57
    "30823F" 637 "AT"  5976.58
    "30486Q" 637 "AT"   167.09
    "30402X" 637 "AT"    99.17
    "702589" 637 "AT"  2009.04
    "672520" 637 "AT"   771.95
    "672647" 637 "AT"     2.29
    "982815" 637 "AT"   150.38
    "50696N" 637 "AT"   603.98
    "31189C" 637 "AT"    18.19
    "505440" 637 "AT"    106.2
    "692648" 637 "AT"    10.77
    "307594" 637 "AT"    961.8
    "142344" 637 "AT"   1744.2
    "28221H" 637 "AT"   553.09
    
    end
    format %tm mofd
Working...
X