Hi Stata Users,
I am using Stata 17 on Windows and have some data that I would want to find a sum by group
Example data (with the desired variables) is below
The original variables are id, year and type and would like to generate a sum by type for each unique ID.
Thanks in advance!
I am using Stata 17 on Windows and have some data that I would want to find a sum by group
Example data (with the desired variables) is below
Code:
* Example generated by -dataex-. For more info, type help dataex clear input byte id int year str1 type int(amt suma sumb sumc) 1 2011 "A" 1200 2100 700 650 1 2013 "A" 900 2100 700 650 1 2014 "B" 700 2100 700 650 1 2015 "C" 650 2100 700 650 2 2012 "A" 850 850 1100 900 2 2014 "B" 1100 850 1100 900 2 2015 "B" 900 850 1100 900 3 2012 "C" 800 700 800 1400 3 2013 "C" 600 700 800 1400 3 2014 "A" 700 700 800 1400 3 2015 "B" 800 700 800 1400 4 2011 "B" 1300 700 1900 4800 4 2012 "C" 1450 700 1900 4800 4 2013 "C" 1300 700 1900 4800 4 2014 "C" 1250 700 1900 4800 4 2014 "B" 600 700 1900 4800 4 2015 "A" 700 700 1900 4800 4 2015 "C" 800 700 1900 4800 5 2012 "C" 900 2550 650 1700 5 2012 "A" 850 2550 650 1700 5 2013 "B" 650 2550 650 1700 5 2014 "A" 750 2550 650 1700 5 2015 "C" 800 2550 650 1700 5 2015 "A" 950 2550 650 1700 end
Thanks in advance!
Comment