Hi everyone,

New Stata user and first-time poster here. I'm trying to create a new categorical variable, catvar, based on 4 continuous variables: avar, bvar, cvar, and dvar.

Basically, catvar = 0 if avar, bvar, cvar, and dvar are all < 70;

catvar = 1 if exactly one of the four continuous variables > 70;

catvar = 2 if exactly two of the four are > 70 and within 10 units of one another;

catvar = 3 if exactly three of the four are > 70 and within 10 units of one another; and

catvar = 4 if all four variables are > 70 and within 10 units of one another.

I'm having some trouble getting the logic/operators to work, and would appreciate any/all tips, readings, and/or suggestions -- thanks so much!