I have a numeric variable that contains all combinations of 1 through 6 (e.g. 12, 124, 34, 6, 56, etc). I want to create a new dichotomous variable based on whether a certain number is within these combinations of numbers. For example, if I have:

12

134

45

16

I want to be able to create a new dichotomous variable for whether or not response includes the number "1". In this case, responses 12, 134, and 16 would produce the answer 1 whereas 45 would produce a 0. I know I could state "If (varname=12 or varname=13 or varname=123, etc) newvar=1" but I wanted something more elegant given the amount of combinations. Any thoughts?

12

134

45

16

I want to be able to create a new dichotomous variable for whether or not response includes the number "1". In this case, responses 12, 134, and 16 would produce the answer 1 whereas 45 would produce a 0. I know I could state "If (varname=12 or varname=13 or varname=123, etc) newvar=1" but I wanted something more elegant given the amount of combinations. Any thoughts?

Last edited: