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
how to fill in missing values of age by individualsHi all, Here is an example: individual value 1 . 1 21 2 51 2 . 2 . 3 . 3 15 3 . How can we fill i…
Variances and Covariances in the panel dataHi everyone, I just started using STATA and I am wondering how can I compute covariances and varianc…
Missing values generated by lagged varDear All, I am using panel data for the universities for 5 years, 2012-2016. I have created a lagge…
Combining stcurve graphs from different stcox analysesI'm working on some stcox analyses where I want to test different thresholds of exposure and I'd lik…
Displaying sigma_u and rho for xtologit using esttabHello there, The standard esttab command does not include an option to display the value, standard …
Subscribe to:
Post Comments (Atom)
0 Response to Calculate Shares of Different Sectors
Post a Comment