I'm trying to figure out how to create a dummy variable in STATA that is dependent on many variables in my dataset.
Specifically, I want to create a new binary variable (CMC; 1= yes; 0 =no) where CMC=1 for each observation if ... 3 or more of the following variables are yes(1). I have a list of about 20 variables that I want the command to consider. For this question might be easier to have 5 variables: var1, var2, var3, var4, and var5.
I've been looking around STATA forum for days and can't find any examples. I'm thinking I will need to use forval and inlist commands, but not sure.
Thanks!