Hi guys
First post here, so please bear with me if I'm doing something wrong :-)
I am trying to generate a variable (revenueTotal) that takes the value of the total sum of another variable (revenue) based on the year (either 2013 or 2019). I use 2013 for my egen command. I then want to do the same for the year 2019 and use the replace command for this. The code is as follows:
However, Stata does not recognise the total function in the replace command and I get the following output:
. // We generate a variable that takes the value of the sum of the revenue of all firms in the data set (dependent on year):
.
. egen revenueTotal = total(revenue) if year==2013
(498 missing values generated)
.
. replace revenueTotal = total(revenue) if year==2019
unknown function total()
r(133);
What am I doing wrong?
Hope someone can help me :-)
Cheers,
Rasmus
First post here, so please bear with me if I'm doing something wrong :-)
I am trying to generate a variable (revenueTotal) that takes the value of the total sum of another variable (revenue) based on the year (either 2013 or 2019). I use 2013 for my egen command. I then want to do the same for the year 2019 and use the replace command for this. The code is as follows:
Code:
// We generate a variable that takes the value of the sum of the revenue of all firms in the data set (dependent on year): egen revenueTotal = total(revenue) if year==2013 replace revenueTotal = total(revenue) if year==2019
. // We generate a variable that takes the value of the sum of the revenue of all firms in the data set (dependent on year):
.
. egen revenueTotal = total(revenue) if year==2013
(498 missing values generated)
.
. replace revenueTotal = total(revenue) if year==2019
unknown function total()
r(133);
What am I doing wrong?
Hope someone can help me :-)
Cheers,
Rasmus
Comment