My question is an extension of that found here: Construct new variable from given 5 categorical variables in Stata
I am an R user and I have been struggling to adjust to the Stata syntax. Also, I'm use to being able to Google for R documentation/examples online and haven't found as many resources for Stata so I've come here.
I have a data set where the rows represent individual people and the columns record various attributes of these people. There are 5 categorical variables (white, hispanic, black, asian, other) that have binary response data, 0 or 1 ("No" or "Yes"). I want to create a mosaic plot of race vs response data using the spineplots package. However, I believe I must first combine all 5 of the categorical variables into a categorical variable with 5 levels that maintains the labels (so I can see the response rate for each ethnicity.) I've been playing around with the egen function but haven't been able to get it to work. Any help would be appreciated.
Edit: Added a depiction of what my data looks like and what I want it to look like.
my data right now:
person_id,black,asian,white,hispanic,responded
1,0,0,1,0,0
2,1,0,0,0,0
3,1,0,0,0,1
4,0,1,0,0,1
5,0,1,0,0,1
6,0,1,0,0,0
7,0,0,1,0,1
8,0,0,0,1,1
what I want is to produce a table through the tabulate command to make the following:
respond, black, asian, white, hispanic
responded to survey | 20, 30, 25, 10, 15
did not respond | 15, 20, 21, 23, 33