This is a really stupid question, but I've been searching for help to no avail.
I'm pretty new to Stata, I've used it in school to run regressions with pre-cleaned data but that's about it.
I'm trying to get some summary stats and I'm at my wit's end. I have number of car crashes per state by year and I want to calculate a total number of crashes per year in each state.
In Excel the formula would be something like =sumifs(state column, specific state, year column, specific year, number of crashes). Hopefully that makes sense, I'm new to asking for help with data stuff. I could use something like that to make a table with the information I want.
I have no clue how to do it in Stata. Sum gives me median, min-max, st. dev, etc, but not a column total. The closest I've been able to get is sorting by year and doing:
by year: tab number_crashes if state == x
but that just gives me a table of frequencies. It seems like there should be option or something to get a column total of the values instead of frequencies.
I'm pretty new to Stata, I've used it in school to run regressions with pre-cleaned data but that's about it.
I'm trying to get some summary stats and I'm at my wit's end. I have number of car crashes per state by year and I want to calculate a total number of crashes per year in each state.
In Excel the formula would be something like =sumifs(state column, specific state, year column, specific year, number of crashes). Hopefully that makes sense, I'm new to asking for help with data stuff. I could use something like that to make a table with the information I want.
I have no clue how to do it in Stata. Sum gives me median, min-max, st. dev, etc, but not a column total. The closest I've been able to get is sorting by year and doing:
by year: tab number_crashes if state == x
but that just gives me a table of frequencies. It seems like there should be option or something to get a column total of the values instead of frequencies.
Comment