Cross-posting @ http://stackoverflow.com/questions/17748340/stata-sales-growth-rate-of-multiple-groups?noredirect=1#comment26020905_17748340
@ german: ="http://www.stata-forum.de/post1716.html#p1716"
I want to calculate the annual sales growth rate of different firm-groups in Stata. The firms are grouped by variables: country and industry.
I summed sales for each group (called it sales_total: sales of all firms in a group with equal country, industry and year):
bysort country year industry: egen sales_total = sum(sales)
and grouped each combination:
egen group = group(year country industry)
I attached a photo with a small example of my observations (I normally have about 10.000 firms in a 10 year span).
I tried multiple combinations such as:
egen group = group(year country industry)
xtset group year, yearly
bys group: g salesgrowth = log(D.sales_total)
or
bysort group: gen salesgrowth=(sales[_n]-sales[_n-1])/sales[_n-1]
also with tsset,
to calculcate the growth, but I always get error messages such as
repeated time values within panel
or
repeated time values within sample
due to the repetition of the number in the group variable.
Can you help me find the yearly growth rate from each group (firms from same country & industry)?
@ german: ="http://www.stata-forum.de/post1716.html#p1716"
I want to calculate the annual sales growth rate of different firm-groups in Stata. The firms are grouped by variables: country and industry.
I summed sales for each group (called it sales_total: sales of all firms in a group with equal country, industry and year):
bysort country year industry: egen sales_total = sum(sales)
and grouped each combination:
egen group = group(year country industry)
I attached a photo with a small example of my observations (I normally have about 10.000 firms in a 10 year span).
I tried multiple combinations such as:
egen group = group(year country industry)
xtset group year, yearly
bys group: g salesgrowth = log(D.sales_total)
or
bysort group: gen salesgrowth=(sales[_n]-sales[_n-1])/sales[_n-1]
also with tsset,
to calculcate the growth, but I always get error messages such as
repeated time values within panel
or
repeated time values within sample
due to the repetition of the number in the group variable.
Can you help me find the yearly growth rate from each group (firms from same country & industry)?
Last edited: