Bysort Stata Sum. And and also two distinct syntaxes for -egen-. Egen sum sum marketusd and egen sum total marketusd which put in a new variable the wrong sum.
Min Max ---------------------------------------------------------------------. If so when I began using Stata in a serious way I started by reading my way through the Getting Started with Stata manual relevant to my setup. Stata cmd bysort varlist.
Reg depvar indvar Example.
Egen tax_zones total tax I dont see that -collapse- is the best solution here given what else you are likely to be doing. Egen sum sum marketusd and egen sum total marketusd which put in a new variable the wrong sum. Stata sum by group. Egen TotalInvestmentsCountry2 sumInvestments In this case we are summing all the investments made by a Firm in each Country across all years and then we are creating the variable TotalInvestmentsCountry2 that has the same value for every row of each unique pair Firm-Country.
