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
Stata seems to add spaces into path where there are none, wich leads to error messageDear statalist, I am using Stata/SE 15.1 for Mac. I am using a global to specify my path at the beg…
Quick questions about the interaction methodsDear Researchers, Greetings, I have quick questions about interaction variables, please. At first,…
Taking Results from Tab2 and Using them to Generate/Recode a new variableI have a big dataset (1.7million obs) and I need to create contour plots by a member_id within the d…
event-study (event-study2)Hi all, I am using Stata 16. My study: I have two periods that I will evaluate; 2008 - 2013 and th…
Linear interpolationHi! I have a variable called year in my dataset but this contains just the year 2006, 2009, 2011, 2…
Subscribe to:
Post Comments (Atom)
0 Response to Creating a categorical variable from multiple continuous variables
Post a Comment