Dear all,
I am trying to calulate the share of different industrial sectors on GDP. In my dataset I have quarterly values for each sector. I have created a cummulative value variable for each sector.
sort country sector obstime
bysort country (sector) : gen cumvalue_agr_deu = sum(obsvalue) ///
if country == "DEU"
sort country sector obstime
bysort country (sector) : gen cumvalue_con_deu = sum(obsvalue) ///
if sector == "CON" && country == "DEU"
sort country sector obstime
bysort country (sector) : gen cumvalue_ind_deu = sum(obsvalue) ///
if sector == "IND" && country == "DEU"
sort country sector obstime
bysort country (sector) : gen cumvalue_ser_deu = sum(obsvalue) ///
if sector == "SER" && country == "DEU"
The cummulaed values of each sector are now displayed in my dataset as follows:
country obstime sector obsvalue qdate deu_agr ita_agr cumvalue_agr_deu
DEU 2018-Q1 AGR 4222.9 232 1 0 4222.9
DEU 2018-Q2 AGR 4203.2 233 1 0 8426.1
DEU 2018-Q3 AGR 4183.5 234 1 0 12609.6
DEU 2018-Q4 AGR 4232.7 235 1 0 16842.3
DEU 2019-Q1 AGR 4334.6 236 1 0 21176.9
DEU 2019-Q2 AGR 4353.8 237 1 0 25530.7
DEU 2019-Q3 AGR 4378.1 238 1 0 29908.8
DEU 2019-Q4 AGR 4391.6 239 1 0 34300.4
DEU 2020-Q1 AGR 4329.4 240 1 0 38629.8
DEU 2020-Q2 AGR 4290.1 241 1 0 42919.9
As a next step I would like to only have the highest cummulated number of each sector (from 2020-Q2), and calculate their share (in %) relative to all values. Does anyone know how to do that?
I would appreciate any kind of help. Thank you in advance!
Related Posts with Calculate Shares of Different Sectors
Structural Break VARHello, How do I test for structural break in Var model? Is the Gregory-Hansen test the appropriate …
Matrix raised to a certain powerHi all, I am new to mata and have a question related to matrix manipulation in MATA. I have: A = (…
mtitles for titles and sub-titles within estab commandHi, I want to export a summary statistics table into Latex that is conditional on more than one var…
Regression outputHi all, I'm running a series of regression with industry and year fixed effect My dependent variabl…
Start counter counting missing values after each non-missing valueHi, I would like to start counter counting missing values after each non-missing value by group (un…
Subscribe to:
Post Comments (Atom)
0 Response to Calculate Shares of Different Sectors
Post a Comment