Hello Everyone,
I am trying to create a discrete variable from two existing variables. The new discrete variable will contain only four values. The name of my relevant variables and conditions based on which I want to generate my new variable are -
New Variable Name: GDPLife
Existing variable: GDPpercapita and LifeExpectancy
Conditions:
GDPLife = 1 if GDPpercapita > 10000 and LifeExpectancy > 70
GDPLife = 2 if GDPpercapita > 10000 and LifeExpectancy <= 70
GDPLife = 3 if GDPpercapita < 10000 and LifeExpectancy > 70
GDPLife = 4 if GDPpercapita < 10000 and LifeExpectancy <= 70
I would also like to mention that there are some missing values in the variable GDPpercapita and its okay if the new variable shows NA in those cases.
In addition to that, I was wondering is it also possible to add labels to the values in the variable GDPLife? For example, I would like to add the following labels.
If GDPLife =1 then the label will be "High Income, High Life Expectancy"
If GDPLife =2 then the label will be "High Income, Low Life Expectancy"
If GDPLife =3 then the label will be "Low Income, High Life Expectancy"
If GDPLife =4 then the label will be "Low Income, Low Life Expectancy"
Many Thanks