I want to construct a 2x2 contingency table to compute the odds ratio. However, I fail to sum up the rows and columns as I wanted them to be. This is my contingency table for now. I want to total up Down Steady and Up into a new variable named Yes.
| |Down|No|Steady|Up|
|--------|----|--|------|--|
|Female | | | | |
|Male | | | | |
|Female.1| | | | |
|Male.1 | | | | |
|Female.2| | | | |
|Male.2 | | | | |
I have tried using colsums but it just totals up the entire column. The output I want is like this:
| |Yes|No|
|------|---|--|
|Female| | |
|Male | | |
Thank you in advance!