Hello,
I have data about the video game industry and I would like to add a control variable that represents the accumulated sales of previous entries in a certain game franchise (e.g. MW2 is an entry in the Call of Duty franchise). This is how a small sample would look:
Franchise Entry Globalsales
A 1 1.27
B 1 2.21
C 1 1.3
C 2 2.41
C 3 2.18
C 4 1.57
C 5 1.2
D 1 3.17
D 2 1.71
D 3 1.01
D 4 1.23
Ultimately it should look like this:
Franchise Entry Globalsales Accumulated_Franchise_sales
A 1 1.27 0
B 1 2.21 0
C 1 1.3 0
C 2 2.41 1.3
C 3 2.18 2.71
C 4 1.57 4.59
C 5 1.2 5.79
D 1 3.17 0
D 2 1.71 3.17
D 3 1.01 4.18
D 4 1.23 5.41
I tried the following commands which did not provide the desired result:
bysort Entry Franchise: egen Accumulated_Franchise_Sales = sum(Globalsales)
bysort Franchise Entry: egen Accumulated_Franchise_Sales = sum(Globalsales)
Could someone please help me with finding a command that would provide the desired result?
Yannick
Related Posts with Accumulating results with two conditions
How to replace dummy by same value of adjacent year for each id observation?Hi my data's dummy 'chaebol' has its value only when year = 2004. How can I replace the value of 199…
Bootstrapping more descriptive of more than one variable in extreme groups of a sample - how to code/program in a smart way?Dear members I am trying hard to code a program that than boostrap descriptives (mean and CV) in eks…
Getting File Ready For Stata AnalysisGreetings Everyone! Dear All, I have Raw Form of data of more the 400 firms as shown below how can …
Measuring dynamicsHello, I'm doing a relatively simple analysis for a large group of banks for years 2011-2020. In pa…
Clustering SEs in Panel IVFE regression eliminates significanceHello, I am studying country structural transformation by regressing log(manufacturing value added …
Subscribe to:
Post Comments (Atom)
0 Response to Accumulating results with two conditions
Post a Comment