Hi! I'm trying to create an indicator variable from several dummy variables (which are not mutually exclusive). It would seem straightforward, but I am encountering some challenges. Could someone pls advise?
Here is a simplified example of what I am trying to do. Let's say we have three dummy variables for food preferences, A1=1 if respondent likes cereal for breakfast, 0 if not / A2=1 if respondent likes salad for lunch, 0 if not / A3=1 if respondent eats desert with dinner, 0 if not. The respondent could like all three, or some combination thereof.
How would I create one variable to catch all? For instance a new variable A, which is =1 if the respondents like breakfast, is =2 if they like salad, and =3 if they like desert, that will not drop those observations that overlap?
Related Posts with Creating an indicator variable from multiple, non-mutually exclusive, dummy variables
calculating distance in a loop using 'spdistance' in STATA 15Dear Statalisters I have shapefile containing information about the geographic coordinates of all t…
Create a variable that is equal to 1 if "the below value" bigger than "the above value"Hello. I'd like to ask for help. I want to make goal, goal_pre, goal_post using by id and target. T…
Creating a custom atrisk table for a survival graphHi all, I want to create an atrisk table in a seperate graph, which i can then combine with a stand…
Geographical dataDear Statalist, I have a time series on road accidents that happened in a particular region. Each a…
How to plot the difference between two marginsplot?Hi, I have two marginsplot for the same model for two different groups, but I would like to have a …
Subscribe to:
Post Comments (Atom)
0 Response to Creating an indicator variable from multiple, non-mutually exclusive, dummy variables
Post a Comment