I hvae a simple question that I cannot find the answer to. I have a data set with two category variable and one continous variable. The categories are state_code and ind_code and the variable is revenue. I simply want to create a dataset with the revenue data summed up state_code and ind_code.
Sample data
state_code ind_code revenue
AL 1 100
AL 1 200
AL 2 50
CA 1 300
CA 2 100
CA 2 50
Desired outcome
1 2
AL 300 50
CA 300 150
It would be nice to have the row and column totals too
Sample data
state_code ind_code revenue
AL 1 100
AL 1 200
AL 2 50
CA 1 300
CA 2 100
CA 2 50
Desired outcome
1 2
AL 300 50
CA 300 150
It would be nice to have the row and column totals too
Comment