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!
Related Posts with Creating a categorical variable from multiple continuous variables
Append multiple variables created in a loop to an excel fileHi all, I have a complicated loop that generates new variables by merging 2 datasets. This loop wil…
New program -underid- available on SSCWith thanks as usual to Kit Baum, a new program underid by myself and Frank Windmeijer is now availa…
Implicit Weight using StataDear all, Can anyone explain the use of weight when conducting MCA (stata code mca) to aggregate ca…
How to graph an epidemiological cluster?Hi everybody, I'd need assistance please. How can I graph on Stata an epidemiological cluster simila…
Testing for autocorrelation in panel without time variable (FE/FD models)Hi everyone, I have cross-sectional data with 3 observations per student for 3 different subjects, …
Subscribe to:
Post Comments (Atom)
0 Response to Creating a categorical variable from multiple continuous variables
Post a Comment